1
|
<?php
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
function adminimal_preprocess_maintenance_page(&$vars) {
|
12
|
|
13
|
|
14
|
|
15
|
|
16
|
|
17
|
adminimal_preprocess_html($vars);
|
18
|
}
|
19
|
|
20
|
|
21
|
|
22
|
|
23
|
function adminimal_preprocess_html(&$vars) {
|
24
|
|
25
|
|
26
|
$adminimal_path = drupal_get_path('theme', 'adminimal');
|
27
|
|
28
|
|
29
|
drupal_add_css($adminimal_path . '/css/reset.css', array('group' => CSS_THEME, 'media' => 'all', 'weight' => -999));
|
30
|
drupal_add_css($adminimal_path . '/css/style.css', array('group' => CSS_THEME, 'media' => 'all', 'weight' => 1));
|
31
|
|
32
|
|
33
|
drupal_add_css($adminimal_path . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'weight' => 999, 'preprocess' => TRUE));
|
34
|
|
35
|
|
36
|
drupal_add_css($adminimal_path . '/css/ie7.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'weight' => 999, 'preprocess' => TRUE));
|
37
|
|
38
|
|
39
|
drupal_add_css($adminimal_path . '/css/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 6', '!IE' => FALSE), 'weight' => 999, 'preprocess' => TRUE));
|
40
|
|
41
|
|
42
|
if (module_exists('homebox')) {
|
43
|
drupal_add_css($adminimal_path . '/css/homebox_custom.css', array('group' => CSS_THEME, 'media' => 'all', 'weight' => 1));
|
44
|
}
|
45
|
|
46
|
|
47
|
$vars['classes_array'][] = 'adminimal-theme';
|
48
|
|
49
|
|
50
|
if (theme_get_setting('style_checkboxes')) {
|
51
|
$vars['classes_array'][] = 'style-checkboxes';
|
52
|
}
|
53
|
|
54
|
|
55
|
if (!theme_get_setting('rounded_buttons')) {
|
56
|
$vars['classes_array'][] = 'no-rounded-buttons';
|
57
|
}
|
58
|
|
59
|
|
60
|
if (theme_get_setting('sticky_actions')) {
|
61
|
$vars['classes_array'][] = 'sticky-actions';
|
62
|
}
|
63
|
|
64
|
|
65
|
if (theme_get_setting('display_icons_config')) {
|
66
|
drupal_add_css($adminimal_path . '/css/icons-config.css', array('group' => CSS_THEME, 'weight' => 10, 'preprocess' => TRUE));
|
67
|
}
|
68
|
|
69
|
|
70
|
if (theme_get_setting('avoid_custom_font')) {
|
71
|
drupal_add_css($adminimal_path . '/css/avoid_custom_font.css', array('group' => CSS_THEME, 'weight' => 9000, 'preprocess' => TRUE));
|
72
|
}
|
73
|
|
74
|
|
75
|
$media_query_mobile = 'only screen and (max-width: 480px)';
|
76
|
$media_query_tablet = 'only screen and (min-width : 481px) and (max-width : 1024px)';
|
77
|
|
78
|
|
79
|
if (theme_get_setting('use_custom_media_queries')) {
|
80
|
$media_query_mobile = theme_get_setting('media_query_mobile');
|
81
|
$media_query_tablet = theme_get_setting('media_query_tablet');
|
82
|
}
|
83
|
|
84
|
|
85
|
$adminimal_skin = theme_get_setting('adminimal_theme_skin');
|
86
|
if ((!is_null($adminimal_skin))) {
|
87
|
drupal_add_css($adminimal_path . '/skins/' . $adminimal_skin . '/' . $adminimal_skin . '.css', array('group' => CSS_THEME, 'weight' => 900, 'preprocess' => TRUE));
|
88
|
|
89
|
drupal_add_css($adminimal_path . '/skins/' . $adminimal_skin . '/mac_os_x.css', array('group' => CSS_THEME, 'weight' => 950, 'preprocess' => TRUE));
|
90
|
drupal_add_js($adminimal_path . '/skins/' . $adminimal_skin . '/' . $adminimal_skin . '.js');
|
91
|
$vars['classes_array'][] = 'adminimal-skin-' . $adminimal_skin ;
|
92
|
}
|
93
|
else {
|
94
|
drupal_add_css($adminimal_path . '/skins/default/default.css', array('group' => CSS_THEME, 'weight' => 900, 'preprocess' => TRUE));
|
95
|
|
96
|
drupal_add_css($adminimal_path . '/skins/default/mac_os_x.css', array('group' => CSS_THEME, 'weight' => 950, 'preprocess' => TRUE));
|
97
|
drupal_add_js($adminimal_path . '/skins/default/default.js');
|
98
|
$vars['classes_array'][] = 'adminimal-skin-default' ;
|
99
|
}
|
100
|
|
101
|
|
102
|
drupal_add_css($adminimal_path . '/css/mobile.css', array('group' => CSS_THEME, 'media' => $media_query_mobile, 'weight' => 1000));
|
103
|
drupal_add_css($adminimal_path . '/css/tablet.css', array('group' => CSS_THEME, 'media' => $media_query_tablet, 'weight' => 1000));
|
104
|
|
105
|
|
106
|
$custom_css_path = 'public://adminimal-custom.css';
|
107
|
if (theme_get_setting('custom_css') && file_exists($custom_css_path)) {
|
108
|
drupal_add_css($custom_css_path, array('group' => CSS_THEME, 'weight' => 9999, 'preprocess' => TRUE));
|
109
|
}
|
110
|
|
111
|
|
112
|
$viewport = array(
|
113
|
'#tag' => 'meta',
|
114
|
'#attributes' => array(
|
115
|
'name' => 'viewport',
|
116
|
'content' => 'width=device-width, maximum-scale=1, minimum-scale=1, user-scalable=no, initial-scale=1',
|
117
|
),
|
118
|
);
|
119
|
drupal_add_html_head($viewport, 'viewport');
|
120
|
|
121
|
|
122
|
|
123
|
|
124
|
$key = array_search('no-sidebars', $vars['classes_array']);
|
125
|
if ($key !== FALSE) {
|
126
|
unset($vars['classes_array'][$key]);
|
127
|
}
|
128
|
|
129
|
if (!empty($vars['page']['sidebar_left']) && !empty($vars['page']['sidebar_right'])) {
|
130
|
$vars['classes_array'][] = 'two-sidebars';
|
131
|
}
|
132
|
elseif (!empty($vars['page']['sidebar_left'])) {
|
133
|
$vars['classes_array'][] = 'one-sidebar sidebar-left';
|
134
|
}
|
135
|
elseif (!empty($vars['page']['sidebar_right'])) {
|
136
|
$vars['classes_array'][] = 'one-sidebar sidebar-right';
|
137
|
}
|
138
|
else {
|
139
|
$vars['classes_array'][] = 'no-sidebars';
|
140
|
}
|
141
|
}
|
142
|
|
143
|
|
144
|
|
145
|
|
146
|
function adminimal_preprocess_page(&$vars) {
|
147
|
$vars['primary_local_tasks'] = $vars['tabs'];
|
148
|
unset($vars['primary_local_tasks']['#secondary']);
|
149
|
$vars['secondary_local_tasks'] = array(
|
150
|
'#theme' => 'menu_local_tasks',
|
151
|
'#secondary' => $vars['tabs']['#secondary'],
|
152
|
);
|
153
|
unset($vars['page']['hidden']);
|
154
|
}
|
155
|
|
156
|
|
157
|
|
158
|
|
159
|
function adminimal_node_add_list($variables) {
|
160
|
$content = $variables['content'];
|
161
|
$output = '';
|
162
|
if ($content) {
|
163
|
$output = '<ul class="admin-list">';
|
164
|
foreach ($content as $item) {
|
165
|
$output .= '<li class="clearfix">';
|
166
|
$output .= '<span class="label">' . l($item['title'], $item['href'], $item['localized_options']) . '</span>';
|
167
|
$output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
|
168
|
$output .= '</li>';
|
169
|
}
|
170
|
$output .= '</ul>';
|
171
|
}
|
172
|
else {
|
173
|
$output = '<p>' . t('You have not created any content types yet. Go to the <a href="@create-content">content type creation page</a> to add a new content type.', array('@create-content' => url('admin/structure/types/add'))) . '</p>';
|
174
|
}
|
175
|
return $output;
|
176
|
}
|
177
|
|
178
|
|
179
|
|
180
|
|
181
|
|
182
|
|
183
|
function adminimal_adminimal_block_content($variables) {
|
184
|
$content = $variables['content'];
|
185
|
$output = '';
|
186
|
if (!empty($content)) {
|
187
|
$output = system_adminimal_compact_mode() ? '<ul class="admin-list compact">' : '<ul class="admin-list">';
|
188
|
foreach ($content as $item) {
|
189
|
$output .= '<li class="leaf">';
|
190
|
$output .= l($item['title'], $item['href'], $item['localized_options']);
|
191
|
if (isset($item['description']) && !system_adminimal_compact_mode()) {
|
192
|
$output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
|
193
|
}
|
194
|
$output .= '</li>';
|
195
|
}
|
196
|
$output .= '</ul>';
|
197
|
}
|
198
|
return $output;
|
199
|
}
|
200
|
|
201
|
|
202
|
|
203
|
|
204
|
|
205
|
|
206
|
function adminimal_tablesort_indicator($variables) {
|
207
|
$style = $variables['style'];
|
208
|
$theme_path = drupal_get_path('theme', 'adminimal');
|
209
|
if ($style == 'asc') {
|
210
|
return theme('image', array('path' => $theme_path . '/images/arrow-asc.png', 'alt' => t('sort ascending'), 'width' => 13, 'height' => 13, 'title' => t('sort ascending')));
|
211
|
}
|
212
|
else {
|
213
|
return theme('image', array('path' => $theme_path . '/images/arrow-desc.png', 'alt' => t('sort descending'), 'width' => 13, 'height' => 13, 'title' => t('sort descending')));
|
214
|
}
|
215
|
}
|
216
|
|
217
|
|
218
|
|
219
|
|
220
|
function adminimal_css_alter(&$css) {
|
221
|
|
222
|
if (isset($css['misc/vertical-tabs.css'])) {
|
223
|
$css['misc/vertical-tabs.css']['data'] = drupal_get_path('theme', 'adminimal') . '/css/vertical-tabs.css';
|
224
|
}
|
225
|
if (isset($css['misc/vertical-tabs-rtl.css'])) {
|
226
|
$css['misc/vertical-tabs-rtl.css']['data'] = drupal_get_path('theme', 'adminimal') . '/css/vertical-tabs-rtl.css';
|
227
|
}
|
228
|
|
229
|
if (isset($css['misc/ui/jquery.ui.theme.css'])) {
|
230
|
$css['misc/ui/jquery.ui.theme.css']['data'] = drupal_get_path('theme', 'adminimal') . '/css/jquery.ui.theme.css';
|
231
|
}
|
232
|
}
|
233
|
|
234
|
|
235
|
|
236
|
|
237
|
function adminimal_js_alter(&$javascript) {
|
238
|
|
239
|
if (isset($javascript[drupal_get_path('module','module_filter').'/js/update_status.js'])) {
|
240
|
$javascript[drupal_get_path('module','module_filter').'/js/update_status.js']['data'] = drupal_get_path('theme', 'adminimal') . '/js/update_status.js';
|
241
|
}
|
242
|
}
|
243
|
|
244
|
|
245
|
|
246
|
|
247
|
|
248
|
function adminimal_admin_block($variables) {
|
249
|
$block = $variables['block'];
|
250
|
$output = '';
|
251
|
|
252
|
|
253
|
if (empty($block['show'])) {
|
254
|
return $output;
|
255
|
}
|
256
|
|
257
|
if (!empty($block['path'])) {
|
258
|
$output .= '<div class="admin-panel ' . check_plain(str_replace("/", " ", $block['path'])) . ' ">';
|
259
|
}
|
260
|
elseif (!empty($block['title'])) {
|
261
|
$output .= '<div class="admin-panel ' . check_plain(strtolower($block['title'])) . '">';
|
262
|
}
|
263
|
else {
|
264
|
$output .= '<div class="admin-panel">';
|
265
|
}
|
266
|
|
267
|
if (!empty($block['title'])) {
|
268
|
$output .= '<h3 class="title">' . $block['title'] . '</h3>';
|
269
|
}
|
270
|
|
271
|
if (!empty($block['content'])) {
|
272
|
$output .= '<div class="body">' . $block['content'] . '</div>';
|
273
|
}
|
274
|
else {
|
275
|
$output .= '<div class="description">' . $block['description'] . '</div>';
|
276
|
}
|
277
|
|
278
|
$output .= '</div>';
|
279
|
|
280
|
return $output;
|
281
|
}
|
282
|
|
283
|
|
284
|
|
285
|
|
286
|
|
287
|
function adminimal_admin_block_content($variables) {
|
288
|
$content = $variables['content'];
|
289
|
$output = '';
|
290
|
|
291
|
if (!empty($content)) {
|
292
|
$class = 'admin-list';
|
293
|
if ($compact = system_admin_compact_mode()) {
|
294
|
$class .= ' compact';
|
295
|
}
|
296
|
$output .= '<dl class="' . $class . '">';
|
297
|
foreach ($content as $item) {
|
298
|
if (!isset($item['path'])) {
|
299
|
$item['path']='';
|
300
|
}
|
301
|
$output .= '<div class="admin-block-item ' . check_plain(str_replace("/", "-", $item['path'])) . '"><dt>' . l($item['title'], $item['href'], $item['localized_options']) . '</dt>';
|
302
|
if (!$compact && isset($item['description'])) {
|
303
|
$output .= '<dd class="description">' . filter_xss_admin($item['description']) . '</dd>';
|
304
|
}
|
305
|
$output .= '</div>';
|
306
|
}
|
307
|
$output .= '</dl>';
|
308
|
}
|
309
|
return $output;
|
310
|
}
|
311
|
|
312
|
|
313
|
|
314
|
|
315
|
function adminimal_table($variables) {
|
316
|
$header = $variables['header'];
|
317
|
$rows = $variables['rows'];
|
318
|
$attributes = $variables['attributes'];
|
319
|
$caption = $variables['caption'];
|
320
|
$colgroups = $variables['colgroups'];
|
321
|
$sticky = $variables['sticky'];
|
322
|
$empty = $variables['empty'];
|
323
|
|
324
|
|
325
|
if (count($header) && $sticky) {
|
326
|
drupal_add_js('misc/tableheader.js');
|
327
|
|
328
|
|
329
|
$attributes['class'][] = 'sticky-enabled';
|
330
|
}
|
331
|
|
332
|
$output = '<div class="overflow-fix">';
|
333
|
$output .= '<table' . drupal_attributes($attributes) . ">\n";
|
334
|
|
335
|
if (isset($caption)) {
|
336
|
$output .= '<caption>' . $caption . "</caption>\n";
|
337
|
}
|
338
|
|
339
|
|
340
|
if (count($colgroups)) {
|
341
|
foreach ($colgroups as $number => $colgroup) {
|
342
|
$attributes = array();
|
343
|
|
344
|
|
345
|
if (isset($colgroup['data'])) {
|
346
|
foreach ($colgroup as $key => $value) {
|
347
|
if ($key == 'data') {
|
348
|
$cols = $value;
|
349
|
}
|
350
|
else {
|
351
|
$attributes[$key] = $value;
|
352
|
}
|
353
|
}
|
354
|
}
|
355
|
else {
|
356
|
$cols = $colgroup;
|
357
|
}
|
358
|
|
359
|
|
360
|
if (is_array($cols) && count($cols)) {
|
361
|
$output .= ' <colgroup' . drupal_attributes($attributes) . '>';
|
362
|
$i = 0;
|
363
|
foreach ($cols as $col) {
|
364
|
$output .= ' <col' . drupal_attributes($col) . ' />';
|
365
|
}
|
366
|
$output .= " </colgroup>\n";
|
367
|
}
|
368
|
else {
|
369
|
$output .= ' <colgroup' . drupal_attributes($attributes) . " />\n";
|
370
|
}
|
371
|
}
|
372
|
}
|
373
|
|
374
|
|
375
|
if (!count($rows) && $empty) {
|
376
|
$header_count = 0;
|
377
|
foreach ($header as $header_cell) {
|
378
|
if (is_array($header_cell)) {
|
379
|
$header_count += isset($header_cell['colspan']) ? $header_cell['colspan'] : 1;
|
380
|
}
|
381
|
else {
|
382
|
++$header_count;
|
383
|
}
|
384
|
}
|
385
|
$rows[] = array(array(
|
386
|
'data' => $empty,
|
387
|
'colspan' => $header_count,
|
388
|
'class' => array('empty', 'message'),
|
389
|
));
|
390
|
}
|
391
|
|
392
|
|
393
|
if (count($header)) {
|
394
|
$ts = tablesort_init($header);
|
395
|
|
396
|
|
397
|
$output .= (count($rows) ? ' <thead><tr>' : ' <tr>');
|
398
|
foreach ($header as $cell) {
|
399
|
$cell = tablesort_header($cell, $header, $ts);
|
400
|
$output .= _theme_table_cell($cell, TRUE);
|
401
|
}
|
402
|
|
403
|
$output .= (count($rows) ? " </tr></thead>\n" : "</tr>\n");
|
404
|
}
|
405
|
else {
|
406
|
$ts = array();
|
407
|
}
|
408
|
|
409
|
|
410
|
if (count($rows)) {
|
411
|
$output .= "<tbody>\n";
|
412
|
$flip = array(
|
413
|
'even' => 'odd',
|
414
|
'odd' => 'even',
|
415
|
);
|
416
|
$class = 'even';
|
417
|
foreach ($rows as $number => $row) {
|
418
|
|
419
|
if (isset($row['data'])) {
|
420
|
$cells = $row['data'];
|
421
|
$no_striping = isset($row['no_striping']) ? $row['no_striping'] : FALSE;
|
422
|
|
423
|
|
424
|
$attributes = $row;
|
425
|
unset($attributes['data']);
|
426
|
unset($attributes['no_striping']);
|
427
|
}
|
428
|
else {
|
429
|
$cells = $row;
|
430
|
$attributes = array();
|
431
|
$no_striping = FALSE;
|
432
|
}
|
433
|
if (count($cells)) {
|
434
|
|
435
|
if (!$no_striping) {
|
436
|
$class = $flip[$class];
|
437
|
$attributes['class'][] = $class;
|
438
|
}
|
439
|
|
440
|
|
441
|
$output .= ' <tr' . drupal_attributes($attributes) . '>';
|
442
|
$i = 0;
|
443
|
foreach ($cells as $cell) {
|
444
|
$cell = tablesort_cell($cell, $header, $ts, $i++);
|
445
|
$output .= _theme_table_cell($cell);
|
446
|
}
|
447
|
$output .= " </tr>\n";
|
448
|
}
|
449
|
}
|
450
|
$output .= "</tbody>\n";
|
451
|
}
|
452
|
|
453
|
$output .= "</table>\n";
|
454
|
$output .= "</div>\n";
|
455
|
return $output;
|
456
|
}
|