1
|
<?php
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
|
16
|
|
17
|
|
18
|
|
19
|
function tao_css_alter(&$css) {
|
20
|
$exclude = array(
|
21
|
'misc/vertical-tabs.css' => FALSE,
|
22
|
'modules/aggregator/aggregator.css' => FALSE,
|
23
|
'modules/block/block.css' => FALSE,
|
24
|
'modules/book/book.css' => FALSE,
|
25
|
'modules/comment/comment.css' => FALSE,
|
26
|
'modules/dblog/dblog.css' => FALSE,
|
27
|
'modules/file/file.css' => FALSE,
|
28
|
'modules/filter/filter.css' => FALSE,
|
29
|
'modules/forum/forum.css' => FALSE,
|
30
|
'modules/help/help.css' => FALSE,
|
31
|
'modules/menu/menu.css' => FALSE,
|
32
|
'modules/node/node.css' => FALSE,
|
33
|
'modules/openid/openid.css' => FALSE,
|
34
|
'modules/poll/poll.css' => FALSE,
|
35
|
'modules/profile/profile.css' => FALSE,
|
36
|
'modules/search/search.css' => FALSE,
|
37
|
'modules/statistics/statistics.css' => FALSE,
|
38
|
'modules/syslog/syslog.css' => FALSE,
|
39
|
'modules/system/admin.css' => FALSE,
|
40
|
'modules/system/maintenance.css' => FALSE,
|
41
|
'modules/system/system.css' => FALSE,
|
42
|
'modules/system/system.admin.css' => FALSE,
|
43
|
'modules/system/system.base.css' => FALSE,
|
44
|
'modules/system/system.maintenance.css' => FALSE,
|
45
|
'modules/system/system.menus.css' => FALSE,
|
46
|
'modules/system/system.messages.css' => FALSE,
|
47
|
'modules/system/system.theme.css' => FALSE,
|
48
|
'modules/taxonomy/taxonomy.css' => FALSE,
|
49
|
'modules/tracker/tracker.css' => FALSE,
|
50
|
'modules/update/update.css' => FALSE,
|
51
|
'modules/user/user.css' => FALSE,
|
52
|
);
|
53
|
$css = array_diff_key($css, $exclude);
|
54
|
}
|
55
|
|
56
|
|
57
|
|
58
|
|
59
|
function tao_theme() {
|
60
|
$items = array();
|
61
|
|
62
|
|
63
|
$items['block'] = array(
|
64
|
'arguments' => array('block' => NULL),
|
65
|
'template' => 'object',
|
66
|
'path' => drupal_get_path('theme', 'tao') .'/templates',
|
67
|
);
|
68
|
$items['comment'] = array(
|
69
|
'arguments' => array('comment' => NULL, 'node' => NULL, 'links' => array()),
|
70
|
'template' => 'object',
|
71
|
'path' => drupal_get_path('theme', 'tao') .'/templates',
|
72
|
);
|
73
|
$items['node'] = array(
|
74
|
'arguments' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE),
|
75
|
'template' => 'node',
|
76
|
'path' => drupal_get_path('theme', 'tao') .'/templates',
|
77
|
);
|
78
|
$items['fieldset'] = array(
|
79
|
'arguments' => array('element' => array()),
|
80
|
'template' => 'fieldset',
|
81
|
'path' => drupal_get_path('theme', 'tao') .'/templates',
|
82
|
);
|
83
|
|
84
|
|
85
|
$items['pager_list'] = array('arguments' => array(
|
86
|
'tags' => array(),
|
87
|
'limit' => 10,
|
88
|
'element' => 0,
|
89
|
'parameters' => array(),
|
90
|
'quantity' => 9,
|
91
|
));
|
92
|
|
93
|
return $items;
|
94
|
}
|
95
|
|
96
|
|
97
|
|
98
|
|
99
|
function tao_preprocess_html(&$vars) {
|
100
|
$vars['classes_array'][] = 'tao';
|
101
|
}
|
102
|
|
103
|
|
104
|
|
105
|
|
106
|
function tao_preprocess_page(&$vars) {
|
107
|
|
108
|
$vars['primary_local_tasks'] = menu_primary_local_tasks();
|
109
|
$vars['secondary_local_tasks'] = menu_secondary_local_tasks();
|
110
|
|
111
|
|
112
|
$vars['site_name'] = l($vars['site_name'], '<front>');
|
113
|
}
|
114
|
|
115
|
|
116
|
|
117
|
|
118
|
function tao_preprocess_block(&$vars) {
|
119
|
$vars['hook'] = 'block';
|
120
|
|
121
|
$vars['attributes_array']['id'] = $vars['block_html_id'];
|
122
|
|
123
|
$vars['title_attributes_array']['class'][] = 'block-title';
|
124
|
$vars['title_attributes_array']['class'][] = 'clearfix';
|
125
|
|
126
|
$vars['content_attributes_array']['class'][] = 'block-content';
|
127
|
$vars['content_attributes_array']['class'][] = 'clearfix';
|
128
|
if ($vars['block']->module == 'block') {
|
129
|
$vars['content_attributes_array']['class'][] = 'prose';
|
130
|
}
|
131
|
|
132
|
$vars['title'] = !empty($vars['block']->subject) ? $vars['block']->subject : '';
|
133
|
|
134
|
|
135
|
|
136
|
|
137
|
|
138
|
|
139
|
if ($vars['block']->module === 'system' && $vars['block']->delta === 'main') {
|
140
|
$vars['classes_array'] = array_diff($vars['classes_array'], array('block'));
|
141
|
$vars['classes_array'][] = 'block-page-content';
|
142
|
}
|
143
|
}
|
144
|
|
145
|
|
146
|
|
147
|
|
148
|
function tao_preprocess_node(&$vars) {
|
149
|
$vars['hook'] = 'node';
|
150
|
|
151
|
$vars['attributes_array']['id'] = "node-{$vars['node']->nid}";
|
152
|
|
153
|
$vars['title_attributes_array']['class'][] = 'node-title';
|
154
|
$vars['title_attributes_array']['class'][] = 'clearfix';
|
155
|
|
156
|
$vars['content_attributes_array']['class'][] = 'node-content';
|
157
|
$vars['content_attributes_array']['class'][] = 'clearfix';
|
158
|
$vars['content_attributes_array']['class'][] = 'prose';
|
159
|
|
160
|
if (isset($vars['content']['links'])) {
|
161
|
$vars['links'] = $vars['content']['links'];
|
162
|
unset($vars['content']['links']);
|
163
|
}
|
164
|
|
165
|
if (isset($vars['content']['comments'])) {
|
166
|
$vars['post_object']['comments'] = $vars['content']['comments'];
|
167
|
unset($vars['content']['comments']);
|
168
|
}
|
169
|
|
170
|
if ($vars['display_submitted']) {
|
171
|
$vars['submitted'] = t('Submitted by !username on !datetime', array(
|
172
|
'!username' => $vars['name'],
|
173
|
'!datetime' => $vars['date'],
|
174
|
));
|
175
|
}
|
176
|
}
|
177
|
|
178
|
|
179
|
|
180
|
|
181
|
function tao_preprocess_comment(&$vars) {
|
182
|
$vars['hook'] = 'comment';
|
183
|
|
184
|
$vars['title_attributes_array']['class'][] = 'comment-title';
|
185
|
$vars['title_attributes_array']['class'][] = 'clearfix';
|
186
|
|
187
|
$vars['content_attributes_array']['class'][] = 'comment-content';
|
188
|
$vars['content_attributes_array']['class'][] = 'clearfix';
|
189
|
|
190
|
$vars['submitted'] = t('Submitted by !username on !datetime', array(
|
191
|
'!username' => $vars['author'],
|
192
|
'!datetime' => $vars['created'],
|
193
|
));
|
194
|
|
195
|
if (isset($vars['content']['links'])) {
|
196
|
$vars['links'] = $vars['content']['links'];
|
197
|
unset($vars['content']['links']);
|
198
|
}
|
199
|
}
|
200
|
|
201
|
|
202
|
|
203
|
|
204
|
function tao_preprocess_fieldset(&$vars) {
|
205
|
$element = $vars['element'];
|
206
|
_form_set_class($element, array('form-wrapper'));
|
207
|
$vars['attributes'] = isset($element['#attributes']) ? $element['#attributes'] : array();
|
208
|
$vars['attributes']['class'][] = 'fieldset';
|
209
|
if (!empty($element['#title'])) {
|
210
|
$vars['attributes']['class'][] = 'titled';
|
211
|
}
|
212
|
if (!empty($element['#id'])) {
|
213
|
$vars['attributes']['id'] = $element['#id'];
|
214
|
}
|
215
|
|
216
|
$description = !empty($element['#description']) ? "<div class='description'>{$element['#description']}</div>" : '';
|
217
|
$children = !empty($element['#children']) ? $element['#children'] : '';
|
218
|
$value = !empty($element['#value']) ? $element['#value'] : '';
|
219
|
$vars['content'] = $description . $children . $value;
|
220
|
$vars['title'] = !empty($element['#title']) ? $element['#title'] : '';
|
221
|
$vars['hook'] = 'fieldset';
|
222
|
}
|
223
|
|
224
|
|
225
|
|
226
|
|
227
|
function tao_preprocess_field(&$vars) {
|
228
|
|
229
|
if ($vars['element']['#field_type'] === 'text_with_summary') {
|
230
|
$vars['classes_array'][] = 'prose';
|
231
|
}
|
232
|
}
|
233
|
|
234
|
|
235
|
|
236
|
|
237
|
|
238
|
|
239
|
|
240
|
|
241
|
|
242
|
function tao_textarea($variables) {
|
243
|
$element = $variables['element'];
|
244
|
$element['#attributes']['name'] = $element['#name'];
|
245
|
$element['#attributes']['id'] = $element['#id'];
|
246
|
$element['#attributes']['cols'] = $element['#cols'];
|
247
|
$element['#attributes']['rows'] = $element['#rows'];
|
248
|
_form_set_class($element, array('form-textarea'));
|
249
|
|
250
|
$wrapper_attributes = array(
|
251
|
'class' => array('form-textarea-wrapper'),
|
252
|
);
|
253
|
|
254
|
|
255
|
if (!empty($element['#resizable'])) {
|
256
|
$wrapper_attributes['class'][] = 'resizable';
|
257
|
}
|
258
|
|
259
|
$output = '<div' . drupal_attributes($wrapper_attributes) . '>';
|
260
|
$output .= '<textarea' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
|
261
|
$output .= '</div>';
|
262
|
return $output;
|
263
|
}
|
264
|
|
265
|
|
266
|
|
267
|
|
268
|
|
269
|
|
270
|
|
271
|
|
272
|
function tao_pager($vars) {
|
273
|
$tags = $vars['tags'];
|
274
|
$element = $vars['element'];
|
275
|
$parameters = $vars['parameters'];
|
276
|
$quantity = $vars['quantity'];
|
277
|
$pager_list = theme('pager_list', $vars);
|
278
|
|
279
|
$links = array();
|
280
|
$links['pager-first'] = theme('pager_first', array(
|
281
|
'text' => (isset($tags[0]) ? $tags[0] : t('First')),
|
282
|
'element' => $element,
|
283
|
'parameters' => $parameters
|
284
|
));
|
285
|
$links['pager-previous'] = theme('pager_previous', array(
|
286
|
'text' => (isset($tags[1]) ? $tags[1] : t('Prev')),
|
287
|
'element' => $element,
|
288
|
'interval' => 1,
|
289
|
'parameters' => $parameters
|
290
|
));
|
291
|
$links['pager-next'] = theme('pager_next', array(
|
292
|
'text' => (isset($tags[3]) ? $tags[3] : t('Next')),
|
293
|
'element' => $element,
|
294
|
'interval' => 1,
|
295
|
'parameters' => $parameters
|
296
|
));
|
297
|
$links['pager-last'] = theme('pager_last', array(
|
298
|
'text' => (isset($tags[4]) ? $tags[4] : t('Last')),
|
299
|
'element' => $element,
|
300
|
'parameters' => $parameters
|
301
|
));
|
302
|
$links = array_filter($links);
|
303
|
$pager_links = theme('links', array(
|
304
|
'links' => $links,
|
305
|
'attributes' => array('class' => 'links pager pager-links')
|
306
|
));
|
307
|
if ($pager_list) {
|
308
|
return "<div class='pager clearfix'>$pager_list $pager_links</div>";
|
309
|
}
|
310
|
}
|
311
|
|
312
|
|
313
|
|
314
|
|
315
|
function tao_pager_list($vars) {
|
316
|
$tags = $vars['tags'];
|
317
|
$element = $vars['element'];
|
318
|
$parameters = $vars['parameters'];
|
319
|
$quantity = $vars['quantity'];
|
320
|
|
321
|
global $pager_page_array, $pager_total;
|
322
|
if ($pager_total[$element] > 1) {
|
323
|
|
324
|
|
325
|
$pager_middle = ceil($quantity / 2);
|
326
|
|
327
|
$pager_current = $pager_page_array[$element] + 1;
|
328
|
|
329
|
$pager_first = $pager_current - $pager_middle + 1;
|
330
|
|
331
|
$pager_last = $pager_current + $quantity - $pager_middle;
|
332
|
|
333
|
$pager_max = $pager_total[$element];
|
334
|
|
335
|
|
336
|
|
337
|
$i = $pager_first;
|
338
|
if ($pager_last > $pager_max) {
|
339
|
|
340
|
$i = $i + ($pager_max - $pager_last);
|
341
|
$pager_last = $pager_max;
|
342
|
}
|
343
|
if ($i <= 0) {
|
344
|
|
345
|
$pager_last = $pager_last + (1 - $i);
|
346
|
$i = 1;
|
347
|
}
|
348
|
|
349
|
|
350
|
$links = array();
|
351
|
|
352
|
|
353
|
if ($i != $pager_max) {
|
354
|
|
355
|
for ($i; $i <= $pager_last && $i <= $pager_max; $i++) {
|
356
|
if ($i < $pager_current) {
|
357
|
$links["$i pager-item"] = theme('pager_previous', array(
|
358
|
'text' => $i,
|
359
|
'element' => $element,
|
360
|
'interval' => ($pager_current - $i),
|
361
|
'parameters' => $parameters
|
362
|
));
|
363
|
}
|
364
|
if ($i == $pager_current) {
|
365
|
$links["$i pager-current"] = array('title' => $i);
|
366
|
}
|
367
|
if ($i > $pager_current) {
|
368
|
$links["$i pager-item"] = theme('pager_next', array(
|
369
|
'text' => $i,
|
370
|
'element' => $element,
|
371
|
'interval' => ($i - $pager_current),
|
372
|
'parameters' => $parameters
|
373
|
));
|
374
|
}
|
375
|
}
|
376
|
return theme('links', array(
|
377
|
'links' => $links,
|
378
|
'attributes' => array('class' => 'links pager pager-list')
|
379
|
));
|
380
|
}
|
381
|
}
|
382
|
return '';
|
383
|
}
|
384
|
|
385
|
|
386
|
|
387
|
|
388
|
function tao_pager_link($vars) {
|
389
|
$text = $vars['text'];
|
390
|
$page_new = $vars['page_new'];
|
391
|
$element = $vars['element'];
|
392
|
$parameters = $vars['parameters'];
|
393
|
$attributes = $vars['attributes'];
|
394
|
|
395
|
$page = isset($_GET['page']) ? $_GET['page'] : '';
|
396
|
if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
|
397
|
$parameters['page'] = $new_page;
|
398
|
}
|
399
|
|
400
|
$query = array();
|
401
|
if (count($parameters)) {
|
402
|
$query = drupal_get_query_parameters($parameters, array());
|
403
|
}
|
404
|
if ($query_pager = pager_get_query_parameters()) {
|
405
|
$query = array_merge($query, $query_pager);
|
406
|
}
|
407
|
|
408
|
|
409
|
if (!isset($attributes['title'])) {
|
410
|
static $titles = NULL;
|
411
|
if (!isset($titles)) {
|
412
|
$titles = array(
|
413
|
t('« first') => t('Go to first page'),
|
414
|
t('‹ previous') => t('Go to previous page'),
|
415
|
t('next ›') => t('Go to next page'),
|
416
|
t('last »') => t('Go to last page'),
|
417
|
);
|
418
|
}
|
419
|
if (isset($titles[$text])) {
|
420
|
$attributes['title'] = $titles[$text];
|
421
|
}
|
422
|
else if (is_numeric($text)) {
|
423
|
$attributes['title'] = t('Go to page @number', array('@number' => $text));
|
424
|
}
|
425
|
}
|
426
|
|
427
|
return array(
|
428
|
'title' => $text,
|
429
|
'href' => $_GET['q'],
|
430
|
'attributes' => $attributes,
|
431
|
'query' => count($query) ? $query : NULL,
|
432
|
);
|
433
|
}
|
434
|
|
435
|
|
436
|
|
437
|
|
438
|
function tao_views_mini_pager($vars) {
|
439
|
$tags = $vars['tags'];
|
440
|
$quantity = $vars['quantity'];
|
441
|
$element = $vars['element'];
|
442
|
$parameters = $vars['parameters'];
|
443
|
|
444
|
global $pager_page_array, $pager_total;
|
445
|
|
446
|
|
447
|
|
448
|
$pager_middle = ceil($quantity / 2);
|
449
|
|
450
|
$pager_current = $pager_page_array[$element] + 1;
|
451
|
|
452
|
$pager_max = $pager_total[$element];
|
453
|
|
454
|
|
455
|
$links = array();
|
456
|
if ($pager_total[$element] > 1) {
|
457
|
$links['pager-previous'] = theme('pager_previous', array(
|
458
|
'text' => (isset($tags[1]) ? $tags[1] : t('Prev')),
|
459
|
'element' => $element,
|
460
|
'interval' => 1,
|
461
|
'parameters' => $parameters
|
462
|
));
|
463
|
$links['pager-current'] = array(
|
464
|
'title' => t('@current of @max', array(
|
465
|
'@current' => $pager_current,
|
466
|
'@max' => $pager_max)
|
467
|
)
|
468
|
);
|
469
|
$links['pager-next'] = theme('pager_next', array(
|
470
|
'text' => (isset($tags[3]) ? $tags[3] : t('Next')),
|
471
|
'element' => $element,
|
472
|
'interval' => 1,
|
473
|
'parameters' => $parameters
|
474
|
));
|
475
|
return theme('links', array('links' => $links, 'attributes' => array('class' => array('links', 'pager', 'views-mini-pager'))));
|
476
|
}
|
477
|
}
|