-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_skin.class.php
544 lines (514 loc) · 21.6 KB
/
_skin.class.php
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
<?php
/**
* This file implements a class derived of the generic Skin class in order to provide custom code for
* the skin in this folder.
*
* This file is part of the b2evolution project - {@link http://b2evolution.net/}
*
* @package skins
* @subpackage material
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
/**
* Specific code for this skin.
*
* ATTENTION: if you make a new skin you have to change the class name below accordingly
*/
class material_blog_Skin extends Skin
{
var $version = '6.1.2';
/**
* Get default name for the skin.
* Note: the admin can customize it.
*/
function get_default_name()
{
return 'Material Blog';
}
/**
* Get default type for the skin.
*/
function get_default_type()
{
return 'normal';
}
/**
* What evoSkins API does has this skin been designed with?
*
* This determines where we get the fallback templates from (skins_fallback_v*)
* (allows to use new markup in new b2evolution versions)
*/
function get_api_version()
{
return 6;
}
/**
* Get supported collection kinds.
*
* This should be overloaded in skins.
*
* For each kind the answer could be:
* - 'yes' : this skin does support that collection kind (the result will be was is expected)
* - 'partial' : this skin is not a primary choice for this collection kind (but still produces an output that makes sense)
* - 'maybe' : this skin has not been tested with this collection kind
* - 'no' : this skin does not support that collection kind (the result would not be what is expected)
* There may be more possible answers in the future...
*/
public function get_supported_coll_kinds()
{
$supported_kinds = array(
'main' => 'maybe',
'std' => 'yes', // Blog
'photo' => 'maybe',
'forum' => 'no',
'manual' => 'no',
'group' => 'no', // Tracker
// Any kind that is not listed should be considered as "maybe" supported
);
return $supported_kinds;
}
/*
* What CSS framework does has this skin been designed with?
*
* This may impact default markup returned by Skin::get_template() for example
*/
function get_css_framework()
{
return 'bootstrap';
}
/**
* Get definitions for editable params
*
* @see Plugin::GetDefaultSettings()
* @param local params like 'for_editing' => true
*/
function get_param_definitions( $params )
{
$r = array_merge( array(
'layout' => array(
'label' => T_('Layout'),
'note' => T_('Select skin layout.'),
'defaultvalue' => 'right_sidebar',
'options' => array(
'single_column' => T_('Single column'),
'left_sidebar' => T_('Left Sidebar'),
'right_sidebar' => T_('Right Sidebar'),
),
'type' => 'select',
),
'colorbox' => array(
'label' => T_('Colorbox Image Zoom'),
'note' => T_('Check to enable javascript zooming on images (using the colorbox script)'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_post' => array(
'label' => T_('Voting on Post Images'),
'note' => T_('Check this to enable AJAX voting buttons in the colorbox zoom view'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_post_numbers' => array(
'label' => T_('Display Votes'),
'note' => T_('Check to display number of likes and dislikes'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_comment' => array(
'label' => T_('Voting on Comment Images'),
'note' => T_('Check this to enable AJAX voting buttons in the colorbox zoom view'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_comment_numbers' => array(
'label' => T_('Display Votes'),
'note' => T_('Check to display number of likes and dislikes'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_user' => array(
'label' => T_('Voting on User Images'),
'note' => T_('Check this to enable AJAX voting buttons in the colorbox zoom view'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'colorbox_vote_user_numbers' => array(
'label' => T_('Display Votes'),
'note' => T_('Check to display number of likes and dislikes'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
'gender_colored' => array(
'label' => T_('Display gender'),
'note' => T_('Use colored usernames to differentiate men & women.'),
'defaultvalue' => 0,
'type' => 'checkbox',
),
'bubbletip' => array(
'label' => T_('Username bubble tips'),
'note' => T_('Check to enable bubble tips on usernames'),
'defaultvalue' => 0,
'type' => 'checkbox',
),
'autocomplete_usernames' => array(
'label' => T_('Autocomplete usernames'),
'note' => T_('Check to enable auto-completion of usernames entered after a "@" sign in the comment forms'),
'defaultvalue' => 1,
'type' => 'checkbox',
),
), parent::get_param_definitions( $params ) );
return $r;
}
/**
* Get ready for displaying the skin.
*
* This may register some CSS or JS...
*/
function display_init()
{
global $Messages, $disp, $debug;
// Request some common features that the parent function (Skin::display_init()) knows how to provide:
parent::display_init( array(
'jquery', // Load jQuery
'font_awesome', // Load Font Awesome (and use its icons as a priority over the Bootstrap glyphicons)
'bootstrap', // Load Bootstrap (without 'bootstrap_theme_css')
'bootstrap_evo_css', // Load the b2evo_base styles for Bootstrap (instead of the old b2evo_base styles)
'bootstrap_messages', // Initialize $Messages Class to use Bootstrap styles
'style_css', // Load the style.css file of the current skin
'colorbox', // Load Colorbox (a lightweight Lightbox alternative + customizations for b2evo)
'bootstrap_init_tooltips', // Inline JS to init Bootstrap tooltips (E.g. on comment form for allowed file extensions)
'disp_auto', // Automatically include additional CSS and/or JS required by certain disps (replace with 'disp_off' to disable this)
) );
}
/**
* Those templates are used for example by the messaging screens.
*/
function get_template( $name )
{
switch( $name )
{
case 'Results':
// Results list:
return array(
'page_url' => '', // All generated links will refer to the current page
'before' => '<div class="results panel panel-default">',
'content_start' => '<div id="$prefix$ajax_content">',
'header_start' => '',
'header_text' => '<div class="center"><ul class="pagination">'
.'$prev$$first$$list_prev$$list$$list_next$$last$$next$'
.'</ul></div>',
'header_text_single' => '',
'header_end' => '',
'head_title' => '<div class="panel-heading fieldset_title"><span class="pull-right">$global_icons$</span><h3 class="panel-title">$title$</h3></div>'."\n",
'global_icons_class' => 'btn btn-default btn-sm',
'filters_start' => '<div class="filters panel-body">',
'filters_end' => '</div>',
'filter_button_class' => 'btn-sm btn-info',
'filter_button_before' => '<div class="form-group pull-right">',
'filter_button_after' => '</div>',
'messages_start' => '<div class="messages form-inline">',
'messages_end' => '</div>',
'messages_separator' => '<br />',
'list_start' => '<div class="table_scroll">'."\n"
.'<table class="table table-striped table-bordered table-hover table-condensed" cellspacing="0">'."\n",
'head_start' => "<thead>\n",
'line_start_head' => '<tr>', // TODO: fusionner avec colhead_start_first; mettre a jour admin_UI_general; utiliser colspan="$headspan$"
'colhead_start' => '<th $class_attrib$>',
'colhead_start_first' => '<th class="firstcol $class$">',
'colhead_start_last' => '<th class="lastcol $class$">',
'colhead_end' => "</th>\n",
'sort_asc_off' => get_icon( 'sort_asc_off' ),
'sort_asc_on' => get_icon( 'sort_asc_on' ),
'sort_desc_off' => get_icon( 'sort_desc_off' ),
'sort_desc_on' => get_icon( 'sort_desc_on' ),
'basic_sort_off' => '',
'basic_sort_asc' => get_icon( 'ascending' ),
'basic_sort_desc' => get_icon( 'descending' ),
'head_end' => "</thead>\n\n",
'tfoot_start' => "<tfoot>\n",
'tfoot_end' => "</tfoot>\n\n",
'body_start' => "<tbody>\n",
'line_start' => '<tr class="even">'."\n",
'line_start_odd' => '<tr class="odd">'."\n",
'line_start_last' => '<tr class="even lastline">'."\n",
'line_start_odd_last' => '<tr class="odd lastline">'."\n",
'col_start' => '<td $class_attrib$>',
'col_start_first' => '<td class="firstcol $class$">',
'col_start_last' => '<td class="lastcol $class$">',
'col_end' => "</td>\n",
'line_end' => "</tr>\n\n",
'grp_line_start' => '<tr class="group">'."\n",
'grp_line_start_odd' => '<tr class="odd">'."\n",
'grp_line_start_last' => '<tr class="lastline">'."\n",
'grp_line_start_odd_last' => '<tr class="odd lastline">'."\n",
'grp_col_start' => '<td $class_attrib$ $colspan_attrib$>',
'grp_col_start_first' => '<td class="firstcol $class$" $colspan_attrib$>',
'grp_col_start_last' => '<td class="lastcol $class$" $colspan_attrib$>',
'grp_col_end' => "</td>\n",
'grp_line_end' => "</tr>\n\n",
'body_end' => "</tbody>\n\n",
'total_line_start' => '<tr class="total">'."\n",
'total_col_start' => '<td $class_attrib$>',
'total_col_start_first' => '<td class="firstcol $class$">',
'total_col_start_last' => '<td class="lastcol $class$">',
'total_col_end' => "</td>\n",
'total_line_end' => "</tr>\n\n",
'list_end' => "</table></div>\n\n",
'footer_start' => '',
'footer_text' => '<div class="center"><ul class="pagination">'
.'$prev$$first$$list_prev$$list$$list_next$$last$$next$'
.'</ul></div><div class="center">$page_size$</div>'
/* T_('Page $scroll_list$ out of $total_pages$ $prev$ | $next$<br />'. */
/* '<strong>$total_pages$ Pages</strong> : $prev$ $list$ $next$' */
/* .' <br />$first$ $list_prev$ $list$ $list_next$ $last$ :: $prev$ | $next$') */,
'footer_text_single' => '<div class="center">$page_size$</div>',
'footer_text_no_limit' => '', // Text if theres no LIMIT and therefor only one page anyway
'page_current_template' => '<span><b>$page_num$</b></span>',
'page_item_before' => '<li>',
'page_item_after' => '</li>',
'prev_text' => T_('Previous'),
'next_text' => T_('Next'),
'no_prev_text' => '',
'no_next_text' => '',
'list_prev_text' => T_('...'),
'list_next_text' => T_('...'),
'list_span' => 11,
'scroll_list_range' => 5,
'footer_end' => "\n\n",
'no_results_start' => '<div class="panel-footer">'."\n",
'no_results_end' => '$no_results$</div>'."\n\n",
'content_end' => '</div>',
'after' => '</div>',
'sort_type' => 'basic'
);
break;
case 'blockspan_form':
// Form settings for filter area:
return array(
'layout' => 'blockspan',
'formclass' => 'form-inline',
'formstart' => '',
'formend' => '',
'title_fmt' => '$title$'."\n",
'no_title_fmt' => '',
'fieldset_begin' => '<fieldset $fieldset_attribs$>'."\n"
.'<legend $title_attribs$>$fieldset_title$</legend>'."\n",
'fieldset_end' => '</fieldset>'."\n",
'fieldstart' => '<div class="form-group form-group-sm" $ID$>'."\n",
'fieldend' => "</div>\n\n",
'labelclass' => 'control-label',
'labelstart' => '',
'labelend' => "\n",
'labelempty' => '<label></label>',
'inputstart' => '',
'inputend' => "\n",
'infostart' => '<div class="form-control-static">',
'infoend' => "</div>\n",
'buttonsstart' => '<div class="form-group form-group-sm">',
'buttonsend' => "</div>\n\n",
'customstart' => '<div class="custom_content">',
'customend' => "</div>\n",
'note_format' => ' <span class="help-inline">%s</span>',
// Additional params depending on field type:
// - checkbox
'fieldstart_checkbox' => '<div class="form-group form-group-sm checkbox" $ID$>'."\n",
'fieldend_checkbox' => "</div>\n\n",
'inputclass_checkbox' => '',
'inputstart_checkbox' => '',
'inputend_checkbox' => "\n",
'checkbox_newline_start' => '',
'checkbox_newline_end' => "\n",
// - radio
'inputclass_radio' => '',
'radio_label_format' => '$radio_option_label$',
'radio_newline_start' => '',
'radio_newline_end' => "\n",
'radio_oneline_start' => '',
'radio_oneline_end' => "\n",
);
case 'compact_form':
case 'Form':
// Default Form settings:
return array(
'layout' => 'fieldset',
'formclass' => 'form-horizontal',
'formstart' => '',
'formend' => '',
'title_fmt' => '<span style="float:right">$global_icons$</span><h2>$title$</h2>'."\n",
'no_title_fmt' => '<span style="float:right">$global_icons$</span>'."\n",
'fieldset_begin' => '<div class="fieldset_wrapper $class$" id="fieldset_wrapper_$id$"><fieldset $fieldset_attribs$><div class="panel panel-default">'."\n"
.'<legend class="panel-heading" $title_attribs$>$fieldset_title$</legend><div class="panel-body $class$">'."\n",
'fieldset_end' => '</div></div></fieldset></div>'."\n",
'fieldstart' => '<div class="form-group" $ID$>'."\n",
'fieldend' => "</div>\n\n",
'labelclass' => 'control-label col-sm-12',
'labelstart' => '',
'labelend' => "\n",
'labelempty' => '<label class="control-label col-sm-12"></label>',
'inputstart' => '<div class="controls col-sm-12">',
'inputend' => "</div>\n",
'infostart' => '<div class="controls col-sm-12"><div class="form-control-static">',
'infoend' => "</div></div>\n",
'buttonsstart' => '<div class="form-group"><div class="control-buttons col-sm-12">',
'buttonsend' => "</div></div>\n\n",
'customstart' => '<div class="custom_content">',
'customend' => "</div>\n",
'note_format' => ' <span class="help-inline">%s</span>',
// Additional params depending on field type:
// - checkbox
'inputclass_checkbox' => '',
'inputstart_checkbox' => '<div class="controls col-sm-9"><div class="checkbox"><label>',
'inputend_checkbox' => "</label></div></div>\n",
'checkbox_newline_start' => '<div class="checkbox">',
'checkbox_newline_end' => "</div>\n",
// - radio
'fieldstart_radio' => '<div class="form-group radio-group" $ID$>'."\n",
'fieldend_radio' => "</div>\n\n",
'inputclass_radio' => '',
'radio_label_format' => '$radio_option_label$',
'radio_newline_start' => '<div class="radio"><label>',
'radio_newline_end' => "</label></div>\n",
'radio_oneline_start' => '<label class="radio-inline">',
'radio_oneline_end' => "</label>\n",
);
case 'linespan_form':
// Linespan form:
return array(
'layout' => 'linespan',
'formclass' => 'form-horizontal',
'formstart' => '',
'formend' => '',
'title_fmt' => '<span style="float:right">$global_icons$</span><h2>$title$</h2>'."\n",
'no_title_fmt' => '<span style="float:right">$global_icons$</span>'."\n",
'fieldset_begin' => '<div class="fieldset_wrapper $class$" id="fieldset_wrapper_$id$"><fieldset $fieldset_attribs$><div class="panel panel-default">'."\n"
.'<legend class="panel-heading" $title_attribs$>$fieldset_title$</legend><div class="panel-body $class$">'."\n",
'fieldset_end' => '</div></div></fieldset></div>'."\n",
'fieldstart' => '<div class="form-group" $ID$>'."\n",
'fieldend' => "</div>\n\n",
'labelclass' => '',
'labelstart' => '',
'labelend' => "\n",
'labelempty' => '',
'inputstart' => '<div class="controls">',
'inputend' => "</div>\n",
'infostart' => '<div class="controls"><div class="form-control-static">',
'infoend' => "</div></div>\n",
'buttonsstart' => '<div class="form-group"><div class="control-buttons">',
'buttonsend' => "</div></div>\n\n",
'customstart' => '<div class="custom_content">',
'customend' => "</div>\n",
'note_format' => ' <span class="help-inline">%s</span>',
// Additional params depending on field type:
// - checkbox
'inputclass_checkbox' => '',
'inputstart_checkbox' => '<div class="controls"><div class="checkbox"><label>',
'inputend_checkbox' => "</label></div></div>\n",
'checkbox_newline_start' => '<div class="checkbox">',
'checkbox_newline_end' => "</div>\n",
'checkbox_basic_start' => '<div class="checkbox"><label>',
'checkbox_basic_end' => "</label></div>\n",
// - radio
'fieldstart_radio' => '',
'fieldend_radio' => '',
'inputstart_radio' => '<div class="controls">',
'inputend_radio' => "</div>\n",
'inputclass_radio' => '',
'radio_label_format' => '$radio_option_label$',
'radio_newline_start' => '<div class="radio"><label>',
'radio_newline_end' => "</label></div>\n",
'radio_oneline_start' => '<label class="radio-inline">',
'radio_oneline_end' => "</label>\n",
);
case 'fixed_form':
// Form with fixed label width:
return array(
'layout' => 'fieldset',
'formclass' => 'form-horizontal',
'formstart' => '',
'formend' => '',
'title_fmt' => '<span style="float:right">$global_icons$</span><h2>$title$</h2>'."\n",
'no_title_fmt' => '<span style="float:right">$global_icons$</span>'."\n",
'fieldset_begin' => '<div class="fieldset_wrapper $class$" id="fieldset_wrapper_$id$"><fieldset $fieldset_attribs$><div class="panel panel-default">'."\n"
.'<legend class="panel-heading" $title_attribs$>$fieldset_title$</legend><div class="panel-body $class$">'."\n",
'fieldset_end' => '</div></div></fieldset></div>'."\n",
'fieldstart' => '<div class="form-group fixedform-group" $ID$>'."\n",
'fieldend' => "</div>\n\n",
'labelclass' => 'control-label fixedform-label',
'labelstart' => '',
'labelend' => "\n",
'labelempty' => '<label class="control-label fixedform-label"></label>',
'inputstart' => '<div class="controls fixedform-controls">',
'inputend' => "</div>\n",
'infostart' => '<div class="controls fixedform-controls"><div class="form-control-static">',
'infoend' => "</div></div>\n",
'buttonsstart' => '<div class="form-group"><div class="control-buttons fixedform-controls">',
'buttonsend' => "</div></div>\n\n",
'customstart' => '<div class="custom_content">',
'customend' => "</div>\n",
'note_format' => ' <span class="help-inline">%s</span>',
// Additional params depending on field type:
// - checkbox
'inputclass_checkbox' => '',
'inputstart_checkbox' => '<div class="controls fixedform-controls"><div class="checkbox"><label>',
'inputend_checkbox' => "</label></div></div>\n",
'checkbox_newline_start' => '<div class="checkbox">',
'checkbox_newline_end' => "</div>\n",
// - radio
'fieldstart_radio' => '<div class="form-group radio-group" $ID$>'."\n",
'fieldend_radio' => "</div>\n\n",
'inputclass_radio' => '',
'radio_label_format' => '$radio_option_label$',
'radio_newline_start' => '<div class="radio"><label>',
'radio_newline_end' => "</label></div>\n",
'radio_oneline_start' => '<label class="radio-inline">',
'radio_oneline_end' => "</label>\n",
);
case 'user_navigation':
// The Prev/Next links of users
return array(
'block_start' => '<ul class="pager">',
'prev_start' => '<li class="previous">',
'prev_end' => '</li>',
'prev_no_user' => '',
'back_start' => '<li>',
'back_end' => '</li>',
'next_start' => '<li class="next">',
'next_end' => '</li>',
'next_no_user' => '',
'block_end' => '</ul>',
);
case 'button_classes':
// Button classes
return array(
'button' => 'btn btn-default btn-xs',
'button_red' => 'btn-danger',
'button_green' => 'btn-success',
'text' => 'btn btn-default btn-xs',
'group' => 'btn-group',
);
case 'tooltip_plugin':
// Plugin name for tooltips: 'bubbletip' or 'popover'
return 'popover';
break;
case 'plugin_template':
// Template for plugins
return array(
'toolbar_before' => '<div class="btn-toolbar $toolbar_class$" role="toolbar">',
'toolbar_after' => '</div>',
'toolbar_title_before' => '<div class="btn-toolbar-title">',
'toolbar_title_after' => '</div>',
'toolbar_group_before' => '<div class="btn-group btn-group-xs" role="group">',
'toolbar_group_after' => '</div>',
'toolbar_button_class' => 'btn btn-default',
);
case 'modal_window_js_func':
// JavaScript function to initialize Modal windows, @see echo_user_ajaxwindow_js()
return 'echo_modalwindow_js_bootstrap';
break;
default:
// Delegate to parent class:
return parent::get_template( $name );
}
}
}
?>