-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.php
1334 lines (1140 loc) · 60 KB
/
edit.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
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* create a new section or edit an existing one
*
* Accepted calls:
* - edit.php
* - edit.php/<id>
* - edit.php?id=<id>
* - edit.php?anchor=<anchor>
*
* @author Bernard Paques
* @author Vincent Noël
* @author GnapZ
* @author Christophe Battarel [email]christophe.battarel@altairis.fr[/email]
* @author Alexis Raimbault
* @tester Agnes
* @tester Marco Pici
* @tester Ghjmora
* @tester Aleko
* @tester Manuel Lopez Gallego
* @tester Jan Boen
* @reference
* @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
*/
// common definitions and initial processing
include_once '../shared/global.php';
include_once '../shared/xml.php'; // input validation
include_once '../images/images.php';
include_once '../locations/locations.php';
include_once '../overlays/overlay.php';
include_once '../tables/tables.php';
include_once '../versions/versions.php'; // roll-back
// look for the id
$id = NULL;
if(isset($_REQUEST['id']))
$id = $_REQUEST['id'];
elseif(isset($context['arguments'][0]))
$id = $context['arguments'][0];
$id = strip_tags($id);
// get the item from the database
$item =& Sections::get($id);
// get the related anchor, if any --use request first, because anchor can change
$anchor = NULL;
if(isset($_REQUEST['anchor']) && $_REQUEST['anchor'])
$anchor =& Anchors::get($_REQUEST['anchor']);
elseif(isset($item['anchor']) && $item['anchor'])
$anchor =& Anchors::get($item['anchor']);
// reflect access rights from anchor
if(!isset($item['active']) && is_object($anchor))
$item['active'] = $anchor->get_active();
// get the related overlay, if any
$overlay = NULL;
if(isset($item['overlay']) && $item['overlay'])
$overlay = Overlay::load($item);
elseif(isset($_REQUEST['variant']) && $_REQUEST['variant'])
$overlay = Overlay::bind($_REQUEST['variant']);
elseif(isset($_SESSION['pasted_variant']) && $_SESSION['pasted_variant']) {
$overlay = Overlay::bind($_SESSION['pasted_variant']);
unset($_SESSION['pasted_variant']);
} elseif(!isset($item['id']) && is_object($anchor) && ($overlay_class = $anchor->get_overlay('section_overlay')))
$overlay = Overlay::bind($overlay_class);
// we are allowed to add a new section
if(!isset($item['id']) && Sections::allow_creation(NULL, $anchor))
$permitted = TRUE;
// we are allowed to modify an existing section
elseif(isset($item['id']) && Sections::allow_modification($item, $anchor))
$permitted = TRUE;
// the default is to disallow access
else
$permitted = FALSE;
// do not always show the edition form
$with_form = FALSE;
// load the skin, maybe with a variant
load_skin('sections', $anchor, isset($item['options']) ? $item['options'] : '');
// clear the tab we are in, if any
if(is_object($anchor))
$context['current_focus'] = $anchor->get_focus();
// path to this page
if(is_object($anchor)&& $anchor->is_viewable())
$context['path_bar'] = $anchor->get_path_bar();
else
$context['path_bar'] = array( 'sections/' => i18n::s('Site map') );
if(isset($item['id']) && isset($item['title']))
$context['path_bar'] = array_merge($context['path_bar'], array(Sections::get_permalink($item) => $item['title']));
// page title
if(isset($item['title']))
$context['page_title'] = sprintf(i18n::s('Edit: %s'), $item['title']);
else
$context['page_title'] = i18n::s('Add a section');
// validate input syntax only if required
if(isset($_REQUEST['option_validate']) && ($_REQUEST['option_validate'] == 'Y')) {
if(isset($_REQUEST['introduction']))
xml::validate($_REQUEST['introduction']);
if(isset($_REQUEST['description']))
xml::validate($_REQUEST['description']);
}
// adjust dates from surfer time zone to UTC time zone
if(isset($_REQUEST['activation_date']) && $_REQUEST['activation_date'])
$_REQUEST['activation_date'] = Surfer::to_GMT($_REQUEST['activation_date']);
if(isset($_REQUEST['expiry_date']) && $_REQUEST['expiry_date'])
$_REQUEST['expiry_date'] = Surfer::to_GMT($_REQUEST['expiry_date']);
// stop crawlers
if(Surfer::is_crawler()) {
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// access denied
} elseif(!$permitted) {
// anonymous users are invited to log in or to register
if(!Surfer::is_logged()) {
if(isset($item['id']))
$link = Sections::get_url($item['id'], 'edit');
elseif(isset($_REQUEST['anchor']))
$link = 'sections/edit.php?anchor='.urlencode($_REQUEST['anchor']);
else
$link = 'sections/edit.php';
Safe::redirect($context['url_to_home'].$context['url_to_root'].'users/login.php?url='.urlencode($link));
}
// permission denied to authenticated user
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// an error occured
} elseif(count($context['error'])) {
$item = $_REQUEST;
$with_form = TRUE;
// process uploaded data
} elseif(isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] == 'POST')) {
// protect from hackers
if(isset($_REQUEST['edit_name']))
$_REQUEST['edit_name'] = preg_replace(FORBIDDEN_IN_NAMES, '_', $_REQUEST['edit_name']);
if(isset($_REQUEST['edit_address']))
$_REQUEST['edit_address'] =& encode_link($_REQUEST['edit_address']);
// allow back-referencing from overlay
if(isset($_REQUEST['id'])) {
$_REQUEST['self_reference'] = 'section:'.$_REQUEST['id'];
$_REQUEST['self_url'] = $context['url_to_root'].Sections::get_permalink($_REQUEST);
}
// overlay may have changed
if(isset($_REQUEST['overlay_type']) && $_REQUEST['overlay_type']) {
// associates are allowed to change overlay types -- see overlays/select.php
if(!Surfer::is_associate())
unset($_REQUEST['overlay_type']);
// overlay type has not changed
elseif(is_object($overlay) && ($overlay->get_type() == $_REQUEST['overlay_type']))
unset($_REQUEST['overlay_type']);
}
// new overlay type
if(isset($_REQUEST['overlay_type']) && $_REQUEST['overlay_type']) {
// delete the previous version, if any
if(is_object($overlay))
$overlay->remember('delete', $_REQUEST);
// new version of page overlay
$overlay = Overlay::bind($_REQUEST['overlay_type']);
}
// when the page has been overlaid
if(is_object($overlay)) {
// update the overlay from form content
$overlay->parse_fields($_REQUEST);
// save content of the overlay in this item
$_REQUEST['overlay'] = $overlay->save();
$_REQUEST['overlay_id'] = $overlay->get_id();
}
// update an existing page
if(isset($_REQUEST['id'])) {
// remember the previous version
if($item['id'])
Versions::save($item, 'section:'.$item['id']);
// overlay has been inserted or updated
if(isset($_REQUEST['overlay_type']) && $_REQUEST['overlay_type'])
$action = 'insert';
else
$action = 'update';
// stop on error
if(!Sections::put($_REQUEST) || (is_object($overlay) && !$overlay->remember($action, $_REQUEST))) {
$item = $_REQUEST;
$with_form = TRUE;
// else display the updated page
} else {
// cascade changes on access rights
if($_REQUEST['active'] != $item['active'])
Anchors::cascade('section:'.$item['id'], $_REQUEST['active']);
// touch the related anchor
if(is_object($anchor))
$anchor->touch('section:update', $item['id'],
isset($_REQUEST['silent']) && ($_REQUEST['silent'] == 'Y'),
isset($_REQUEST['notify_watchers']) && ($_REQUEST['notify_watchers'] == 'Y'),
isset($_REQUEST['notify_followers']) && ($_REQUEST['notify_followers'] == 'Y'));
// display the updated page
Safe::redirect($context['url_to_home'].$context['url_to_root'].Sections::get_permalink($item));
}
// create a new section
} elseif(!$_REQUEST['id'] = Sections::post($_REQUEST)) {
$item = $_REQUEST;
$with_form = TRUE;
// successful post
} else {
// allow back-referencing from overlay
$_REQUEST['self_reference'] = 'section:'.$_REQUEST['id'];
$_REQUEST['self_url'] = $context['url_to_root'].Sections::get_permalink($_REQUEST);
// post an overlay, with the new section id --don't stop on error
if(is_object($overlay))
$overlay->remember('insert', $_REQUEST);
// touch the related anchor
if(is_object($anchor))
$anchor->touch('section:create', $_REQUEST['id'],
isset($_REQUEST['silent']) && ($_REQUEST['silent'] == 'Y'),
isset($_REQUEST['notify_watchers']) && ($_REQUEST['notify_watchers'] == 'Y'),
isset($_REQUEST['notify_followers']) && ($_REQUEST['notify_followers'] == 'Y'));
// increment the post counter of the surfer
Users::increment_posts(Surfer::get_id());
// get the new item
$section =& Anchors::get('section:'.$_REQUEST['id'], TRUE);
// reward the poster for new posts
$context['page_title'] = i18n::s('Thank you for your contribution');
$context['text'] .= '<p>'.i18n::s('Please review the new page carefully and fix possible errors rapidly.').'</p>';
// list persons that have been notified
$context['text'] .= Mailer::build_recipients(i18n::s('Persons that have been notified'));
// follow-up commands
$follow_up = i18n::s('What do you want to do now?');
$menu = array();
$menu = array_merge($menu, array($section->get_url() => i18n::s('View the section')));
if(Surfer::may_upload())
$menu = array_merge($menu, array('images/edit.php?anchor='.urlencode('section:'.$_REQUEST['id']) => i18n::s('Add an image')));
if(preg_match('/\bwith_files\b/i', $section->item['options']) && Surfer::may_upload())
$menu = array_merge($menu, array('files/edit.php?anchor='.urlencode('section:'.$_REQUEST['id']) => i18n::s('Upload a file')));
if(preg_match('/\bwith_links\b/i', $section->item['options']))
$menu = array_merge($menu, array('links/edit.php?anchor='.urlencode('section:'.$_REQUEST['id']) => i18n::s('Add a link')));
if(is_object($anchor))
$menu = array_merge($menu, array('sections/edit.php?anchor='.urlencode($anchor->get_reference()) => i18n::s('Add another section')));
$follow_up .= Skin::build_list($menu, 'menu_bar');
$context['text'] .= Skin::build_block($follow_up, 'bottom');
// log the creation of a new section
$label = sprintf(i18n::c('New section: %s'), strip_tags($section->get_title()));
if(is_object($anchor))
$description = sprintf(i18n::s('Sent by %s in %s'), Surfer::get_name(), $anchor->get_title());
else
$description = sprintf(i18n::s('Sent by %s'), Surfer::get_name());
$link = $context['url_to_home'].$context['url_to_root'].$section->get_url();
$description .= "\n\n".$section->get_teaser('basic')
."\n\n".'<a href="'.$link.'">'.$link.'</a>';
Logger::notify('sections/edit.php', $label, $description);
}
// display the form on GET
} else
$with_form = TRUE;
// display the form
if($with_form) {
// the form to edit a section
$context['text'] .= '<form method="post" action="'.$context['script_url'].'" onsubmit="return validateDocumentPost(this)" id="main_form" enctype="multipart/form-data"><div>';
$fields = array();
//
// panels
//
$panels = array();
//
// index tab - fields that contribute directly to the section index page
//
$text = '';
// the title
if(!is_object($overlay) || !($label = $overlay->get_label('title', isset($item['id'])?'edit':'new')))
$label = i18n::s('Title').' *';
// copy this as compact title on initial edit
if((!isset($item['index_title']) || !$item['index_title']) && isset($item['title']))
$item['index_title'] = $item['title'];
$input = '<textarea name="index_title" id="index_title" rows="2" cols="50" accesskey="t">'.encode_field(isset($item['index_title']) ? $item['index_title'] : '').'</textarea>'
.'<input type="hidden" id="shadow_title" value="'.encode_field(isset($item['index_title']) ? $item['index_title'] : '').'" />';
if(!is_object($overlay) || !($hint = $overlay->get_label('title_hint', isset($item['id'])?'edit':'new')))
$hint = i18n::s('Please provide a meaningful title.');
$fields[] = array($label, $input, $hint);
// the introduction
if(!is_object($overlay) || !($label = $overlay->get_label('introduction', isset($item['id'])?'edit':'new')))
$label = i18n::s('Introduction');
$input = '<textarea name="introduction" rows="5" cols="50" accesskey="i">'.encode_field(isset($item['introduction']) ? $item['introduction'] : '').'</textarea>';
if(!is_object($overlay) || !($hint = $overlay->get_label('introduction_hint', isset($item['id'])?'edit':'new')))
$hint = i18n::s('Appears at the site map, near section title');
$fields[] = array($label, $input, $hint);
// include overlay fields, if any
if(is_object($overlay))
$fields = array_merge($fields, $overlay->get_fields($item));
// the description label
if(!is_object($overlay) || !($label = $overlay->get_label('description', isset($item['id'])?'edit':'new')))
$label = i18n::s('Description');
// use the editor if possible
$input = Surfer::get_editor('description', isset($item['description'])?$item['description']:'');
if(!is_object($overlay) || !($hint = $overlay->get_label('description_hint', isset($item['id'])?'edit':'new')))
$hint = '';
$fields[] = array($label, $input, $hint);
// tags
$label = i18n::s('Tags');
$input = '<input type="text" name="tags" id="tags" value="'.encode_field(isset($item['tags'])?$item['tags']:'').'" size="45" maxlength="255" accesskey="t" /><div id="tags_choices" class="autocomplete"></div>';
$hint = i18n::s('A comma-separated list of keywords');
$fields[] = array($label, $input, $hint);
// append regular fields
$text .= Skin::build_form($fields);
$fields = array();
// settings for attached pages
//
// layout for related articles
$label = i18n::s('Layout');
$input = '';
$custom_layout = '';
if(!isset($item['articles_layout']))
$item['articles_layout'] = 'decorated';
elseif(!preg_match('/(accordion|alistapart|carrousel|compact|daily|decorated|digg|hardboiled|jive|map|newspaper|none|simile|slashdot|table|tagged|titles|yabb)/', $item['articles_layout'])) {
$custom_layout = $item['articles_layout'];
$item['articles_layout'] = 'custom';
}
$input .= '<input type="radio" name="articles_layout" value="decorated"';
if($item['articles_layout'] == 'decorated')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('decorated - A list decorated with images');
$input .= BR.'<input type="radio" name="articles_layout" value="digg"';
if($item['articles_layout'] == 'digg')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('digg - To order pages by rating');
$input .= BR.'<input type="radio" name="articles_layout" value="slashdot"';
if($item['articles_layout'] == 'slashdot')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('slashdot - List most recent pages equally');
$input .= BR.'<input type="radio" name="articles_layout" value="map"';
if($item['articles_layout'] == 'map')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('map - Map in two columns, like Yahoo!');
$input .= BR.'<input type="radio" name="articles_layout" value="accordion"';
if($item['articles_layout'] == 'accordion')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('accordion - Expose one item at a time in a stack')
.BR.'<input type="radio" name="articles_layout" value="carrousel"';
if($item['articles_layout'] == 'carrousel')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('carrousel - Animate clickable images')
.BR.'<input type="radio" name="articles_layout" value="titles"';
if($item['articles_layout'] == 'titles')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('titles - Use only titles and thumbnails')
.BR.'<input type="radio" name="articles_layout" value="table"';
if($item['articles_layout'] == 'table')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('table - A table of recent pages');
$input .= BR.'<input type="radio" name="articles_layout" value="daily"';
if($item['articles_layout'] == 'daily')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('daily - A list of stamped pages (blog)');
$input .= BR.'<input type="radio" name="articles_layout" value="newspaper"';
if($item['articles_layout'] == 'newspaper')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('newspaper - Highlight four most recent pages');
$input .= BR.'<input type="radio" name="articles_layout" value="hardboiled"';
if($item['articles_layout'] == 'hardboiled')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('hardboiled - Highlight two most recent pages');
$input .= BR.'<input type="radio" name="articles_layout" value="jive"';
if($item['articles_layout'] == 'jive')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('jive - Display most of articles content');
$input .= BR.'<input type="radio" name="articles_layout" value="yabb"';
if($item['articles_layout'] == 'yabb')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('yabb - A discussion board');
$input .= BR.'<input type="radio" name="articles_layout" value="alistapart"';
if($item['articles_layout'] == 'alistapart')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('alistapart - Display entirely the last published page');
$input .= BR.'<input type="radio" name="articles_layout" value="tagged"';
if($item['articles_layout'] == 'tagged')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('tagged - Titles and tags');
$input .= BR.'<input type="radio" name="articles_layout" value="simile"';
if($item['articles_layout'] == 'simile')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('simile - Dots and titles in a timeline');
$input .= BR.'<input type="radio" name="articles_layout" value="compact"';
if($item['articles_layout'] == 'compact')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('compact - A compact list');
$input .= BR.'<input type="radio" name="articles_layout" value="custom" id="custom_articles_layout"';
if($item['articles_layout'] == 'custom')
$input .= ' checked="checked"';
$input .= '/> '.sprintf(i18n::s('Use the customized layout %s'), '<input type="text" name="articles_custom_layout" value="'.encode_field($custom_layout).'" size="32" onfocus="$(\'custom_articles_layout\').checked=1" />');
$input .= BR.'<input type="radio" name="articles_layout" value="none"';
if($item['articles_layout'] == 'none')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('Do not list pages').BR;
$fields[] = array($label, $input);
// content options
$label = i18n::s('Options');
$input = '<input type="text" name="content_options" id="content_options" size="55" value="'.encode_field(isset($item['content_options']) ? $item['content_options'] : 'auto_publish').'" maxlength="255" accesskey="o" />'
.JS_PREFIX
.'function append_to_content_options(keyword) {'."\n"
.' var target = $("content_options");'."\n"
.' target.value = target.value + " " + keyword;'."\n"
.'}'."\n"
.JS_SUFFIX."\n";
$keywords = array();
$keywords[] = '<a onclick="javascript:append_to_content_options(\'auto_publish\')" style="cursor: pointer;">auto_publish</a> - '.i18n::s('Pages are not reviewed prior publication');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'anonymous_edit\')" style="cursor: pointer;">anonymous_edit</a> - '.i18n::s('Allow anonymous surfers to change content');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'members_edit\')" style="cursor: pointer;">members_edit</a> - '.i18n::s('Allow members to change content');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'comments_as_wall\')" style="cursor: pointer;">comments_as_wall</a> - '.i18n::s('Allow easy interactions between people');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'no_comments\')" style="cursor: pointer;">no_comments</a> - '.i18n::s('Disallow post of new comments');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'files_by_title\')" style="cursor: pointer;">files_by_title</a> - '.i18n::s('Sort files by title (and not by date)');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'no_files\')" style="cursor: pointer;">no_files</a> - '.i18n::s('Prevent the upload of new files');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'links_by_title\')" style="cursor: pointer;">links_by_title</a> - '.i18n::s('Sort links by title (and not by date)');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'no_links\')" style="cursor: pointer;">no_links</a> - '.i18n::s('Disallow post of new links');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'with_neighbours\')" style="cursor: pointer;">with_neighbours</a> - '.i18n::s('Add links to previous and next pages in the same section');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'view_as_chat\')" style="cursor: pointer;">view_as_chat</a> - '.i18n::s('Real-time collaboration');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'view_as_tabs\')" style="cursor: pointer;">view_as_tabs</a> - '.i18n::s('Tabbed panels');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'view_as_wiki\')" style="cursor: pointer;">view_as_wiki</a> - '.i18n::s('Discussion is separate from content');
$keywords[] = 'view_as_foo_bar - '.sprintf(i18n::s('Branch out to %s'), 'articles/view_as_foo_bar.php');
$keywords[] = 'edit_as_simple - '.sprintf(i18n::s('Branch out to %s'), 'articles/edit_as_simple.php');
if(isset($context['content_without_details']) && ($context['content_without_details'] == 'Y'))
$keywords[] = '<a onclick="javascript:append_to_content_options(\'with_details\')" style="cursor: pointer;">with_details</a> - '.i18n::s('Show page details to all surfers');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'without_rating\')" style="cursor: pointer;">without_rating</a> - '.i18n::s('Surfers are not allowed to rate pages in this section');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'rate_as_digg\')" style="cursor: pointer;">rate_as_digg</a> - '.i18n::s('Ask explicitly for more votes');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'with_export_tools\')" style="cursor: pointer;">with_export_tools</a> - '.i18n::s('Add conversion tools to PDF, MS-Word');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'with_prefix_profile\')" style="cursor: pointer;">with_prefix_profile</a> - '.i18n::s('Introduce the poster before main text');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'with_suffix_profile\')" style="cursor: pointer;">with_suffix_profile</a> - '.i18n::s('Append some poster details at the bottom of the page');
$keywords[] = '<a onclick="javascript:append_to_content_options(\'with_extra_profile\')" style="cursor: pointer;">with_extra_profile</a> - '.i18n::s('Append some poster details aside the page (adequate to most weblogs)');
$hint = i18n::s('You may combine several keywords:').Skin::finalize_list($keywords, 'compact');
$fields[] = array($label, $input, $hint);
// content overlay
if(Surfer::is_associate()) {
$label = i18n::s('Overlay');
$input = '<input type="text" name="content_overlay" size="50" value="'.encode_field(isset($item['content_overlay']) ? $item['content_overlay'] : '').'" maxlength="64" />';
$hint = sprintf(i18n::s('Script used to %s in this section'), Skin::build_link('overlays/', i18n::s('overlay articles'), 'help'));
$fields[] = array($label, $input, $hint);
}
// content template
if(Surfer::is_associate()) {
$label = i18n::s('Templates');
$input = '<input type="text" name="articles_templates" size="50" value="'.encode_field(isset($item['articles_templates']) ? $item['articles_templates'] : '').'" maxlength="250" />';
$hint = sprintf(i18n::s('One or several %s. This setting overrides the overlay setting.'), Skin::build_link(Sections::get_url('templates'), i18n::s('templates'), 'help'));
$fields[] = array($label, $input, $hint);
}
// the prefix
$label = i18n::s('Header');
$input = '<textarea name="prefix" rows="2" cols="50">'.encode_field(isset($item['prefix']) ? $item['prefix'] : '').'</textarea>';
$hint = i18n::s('To be inserted at the top of related pages.');
$fields[] = array($label, $input, $hint);
// the suffix
$label = i18n::s('Footer');
$input = '<textarea name="suffix" rows="2" cols="50">'.encode_field(isset($item['suffix']) ? $item['suffix'] : '').'</textarea>';
$hint = i18n::s('To be inserted at the bottom of related pages.');
$fields[] = array($label, $input, $hint);
// append fields
$text .= Skin::build_box(i18n::s('Pages'), Skin::build_form($fields), 'folded');
$fields = array();
// settings for sub-sections
//
// layout for sub-sections - default is 'decorated'
$label = i18n::s('Layout');
if(!isset($item['sections_count']) || ($item['sections_count'] < 1))
$item['sections_count'] = SECTIONS_PER_PAGE;
$input = sprintf(i18n::s('List up to %s sub-sections with the following layout:'), '<input type="text" name="sections_count" value="'.encode_field($item['sections_count']).'" size="2" />').BR;
$custom_layout = '';
if(!isset($item['sections_layout']))
$item['sections_layout'] = 'none';
elseif(!preg_match('/(accordion|carrousel|compact|decorated|folded|freemind|inline|jive|map|slashdot|titles|yabb|none)/', $item['sections_layout'])) {
$custom_layout = $item['sections_layout'];
$item['sections_layout'] = 'custom';
}
$input .= '<input type="radio" name="sections_layout" value="decorated"';
if($item['sections_layout'] == 'decorated')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('decorated - A list decorated with images')
.BR.'<input type="radio" name="sections_layout" value="slashdot"';
if($item['sections_layout'] == 'slashdot')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('slashdot - List most recent pages equally')
.BR.'<input type="radio" name="sections_layout" value="map"';
if($item['sections_layout'] == 'map')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('map - Map in two columns, like Yahoo!')
.BR.'<input type="radio" name="sections_layout" value="accordion"';
if($item['sections_layout'] == 'accordion')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('accordion - Expose one item at a time in a stack')
.BR.'<input type="radio" name="sections_layout" value="carrousel"';
if($item['sections_layout'] == 'carrousel')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('carrousel - Animate clickable images')
.BR.'<input type="radio" name="sections_layout" value="titles"';
if($item['sections_layout'] == 'titles')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('titles - Use only titles and thumbnails')
.BR.'<input type="radio" name="sections_layout" value="freemind"';
if($item['sections_layout'] == 'freemind')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('freemind - Build an interactive mind map')
.BR.'<input type="radio" name="sections_layout" value="jive"';
if($item['sections_layout'] == 'jive')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('jive - List 5 threads per board')
.BR.'<input type="radio" name="sections_layout" value="yabb"';
if($item['sections_layout'] == 'yabb')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('yabb - A discussion forum')
.BR.'<input type="radio" name="sections_layout" value="inline"';
if($item['sections_layout'] == 'inline')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('inline - List sections and related pages')
.BR.'<input type="radio" name="sections_layout" value="folded"';
if($item['sections_layout'] == 'folded')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('folded - One folded box per section, with content')
.BR.'<input type="radio" name="sections_layout" value="compact"';
if($item['sections_layout'] == 'compact')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('compact - A compact list')
.BR.'<input type="radio" name="sections_layout" value="custom" id="custom_sections_layout"';
if($item['sections_layout'] == 'custom')
$input .= ' checked="checked"';
$input .= '/> '.sprintf(i18n::s('Use the customized layout %s'), '<input type="text" name="sections_custom_layout" value="'.encode_field($custom_layout).'" size="32" onfocus="$(\'custom_sections_layout\').checked=1" />')
.BR.'<input type="radio" name="sections_layout" value="none"';
if($item['sections_layout'] == 'none')
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('Do not list sections');
$fields[] = array($label, $input);
// content overlay
if(Surfer::is_associate()) {
$label = i18n::s('Overlay');
$input = '<input type="text" name="section_overlay" size="20" value="'.encode_field(isset($item['section_overlay']) ? $item['section_overlay'] : '').'" maxlength="64" />';
$hint = sprintf(i18n::s('Script used to %s in this section'), Skin::build_link('overlays/', i18n::s('overlay sub-sections'), 'help'));
$fields[] = array($label, $input, $hint);
}
// append fields
$text .= Skin::build_box(i18n::s('Sub-sections'), Skin::build_form($fields), 'folded');
$fields = array();
// rendering options
// trailer information
$label = i18n::s('Trailer');
$input = Surfer::get_editor('trailer', isset($item['trailer'])?$item['trailer']:'');
$hint = i18n::s('Text to be appended at the bottom of the page, after all other elements attached to this page.');
$fields[] = array($label, $input, $hint);
// the icon url may be set after the page has been created
if(isset($item['id'])) {
$label = i18n::s('Image');
$input = '';
$hint = '';
// show the current icon
if(isset($item['icon_url']) && $item['icon_url']) {
$input .= '<img src="'.preg_replace('/\/images\/section\/[0-9]+\//', "\\0thumbs/", $item['icon_url']).'" alt="" />'.BR;
$command = i18n::s('Change');
} elseif(Surfer::may_upload()) {
$hint .= i18n::s('Image to be displayed in the panel aside the page.');
$command = i18n::s('Add an image');
}
$value = '';
if(isset($item['icon_url']) && $item['icon_url'])
$value = $item['icon_url'];
$input .= '<input type="text" name="icon_url" size="55" value="'.encode_field($value).'" maxlength="255" />';
if(Surfer::may_upload())
$input .= ' <span class="details">'.Skin::build_link('images/edit.php?anchor='.urlencode('section:'.$item['id']).'&action=icon', $command, 'button').'</span>';
$fields[] = array($label, $input, $hint);
}
// extra information
$label = i18n::s('Extra');
$input = Surfer::get_editor('extra', isset($item['extra'])?$item['extra']:'');
$hint = i18n::s('Text to be inserted in the panel aside the page. Use [box.extra=title]content[/box] or plain HTML.');
$fields[] = array($label, $input, $hint);
// news can be either a static or an animated list
$label = i18n::s('News');
if(!isset($item['index_news_count']) || ($item['index_news_count'] < 1) || ($item['index_news_count'] > 7))
$item['index_news_count'] = 5;
$input = '<input type="radio" name="index_news" value="static"';
if(!isset($item['index_news']) || !preg_match('/(rotate|scroll|none)/', $item['index_news']))
$input .= ' checked="checked"';
$input .= '/> '.sprintf(i18n::s('List up to %s news aside.'), '<input type="text" name="index_news_count" value="'.encode_field($item['index_news_count']).'" size="2" />');
$input .= BR.'<input type="radio" name="index_news" value="scroll"';
if(isset($item['index_news']) && ($item['index_news'] == 'scroll'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('Similar to the first option, except that displayed information is scrolling.');
$input .= BR.'<input type="radio" name="index_news" value="rotate"';
if(isset($item['index_news']) && ($item['index_news'] == 'rotate'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('Similar to the first option, except that news are rotated.');
$input .= BR.'<input type="radio" name="index_news" value="none"';
if(isset($item['index_news']) && ($item['index_news'] == 'none'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('Do not list news.');
$fields[] = array($label, $input);
// append fields
$text .= Skin::build_box(i18n::s('More content'), Skin::build_form($fields), 'folded');
$fields = array();
// append fields
$text .= Skin::build_form($fields);
$fields = array();
// display in a separate panel
if($text)
$panels[] = array('index', i18n::s('Index page'), 'index_panel', $text);
//
// resources tab
//
$text = '';
// splash message for new items
if(!isset($item['id']))
$text .= '<p>'.i18n::s('Submit the new item, and you will be able to add resources afterwards.').'</p>';
// resources attached to this anchor
else {
// images
$box = '';
if(Images::allow_creation($anchor, $item, 'section')) {
$menu = array( 'images/edit.php?anchor='.urlencode('section:'.$item['id']) => i18n::s('Add an image') );
$box .= Skin::build_list($menu, 'menu_bar');
}
if($items = Images::list_by_date_for_anchor('section:'.$item['id']))
$box .= Skin::build_list($items, 'decorated');
if($box)
$text .= Skin::build_box(i18n::s('Images'), $box, 'folded');
// files
$box = '';
if(Files::allow_creation($anchor, $item, 'section')) {
$menu = array( 'files/edit.php?anchor='.urlencode('section:'.$item['id']) => i18n::s('Add a file') );
$box .= Skin::build_list($menu, 'menu_bar');
}
if($items = Files::list_embeddable_for_anchor('section:'.$item['id'], 0, 50))
$box .= Skin::build_list($items, 'decorated');
if($box)
$text .= Skin::build_box(i18n::s('Files'), $box, 'folded');
// locations
$box = '';
if(Locations::allow_creation($anchor, $item, 'section')) {
$menu = array( 'locations/edit.php?anchor='.urlencode('section:'.$item['id']) => i18n::s('Add a location') );
$box .= Skin::build_list($menu, 'menu_bar');
}
if($items = Locations::list_by_date_for_anchor('section:'.$item['id'], 0, 50, 'section:'.$item['id']))
$box .= Skin::build_list($items, 'decorated');
if($box)
$text .= Skin::build_box(i18n::s('Locations'), $box, 'folded');
// tables
$box = '';
if(Tables::allow_creation($anchor, $item, 'section')) {
$menu = array( 'tables/edit.php?anchor='.urlencode('section:'.$item['id']) => i18n::s('Add a table') );
$box .= Skin::build_list($menu, 'menu_bar');
}
if($items = Tables::list_by_date_for_anchor('section:'.$item['id'], 0, 50, 'section:'.$item['id']))
$box .= Skin::build_list($items, 'decorated');
if($box)
$text .= Skin::build_box(i18n::s('Tables'), $box, 'folded');
}
// display in a separate panel
if($text)
$panels[] = array('resources', i18n::s('Resources'), 'resources_panel', $text);
//
// options tab
//
$text = '';
// provide information to section owner, and to editors of parent section
if(Sections::is_owned($item, $anchor) || Surfer::is_associate()) {
// owner
if(isset($item['owner_id'])) {
$label = i18n::s('Owner');
if($owner = Users::get($item['owner_id']))
$input = Users::get_link($owner['full_name'], $owner['email'], $owner['id']);
else
$input = i18n::s('No owner has been found.');
// only real owner can delegate to another person
if(Sections::is_owned($item, $anchor, TRUE) || Surfer::is_associate())
$input .= ' <span class="details">'.Skin::build_link(Sections::get_url($item['id'], 'own'), i18n::s('Change'), 'button').'</span>';
$fields[] = array($label, $input);
}
// editors
$label = i18n::s('Editors');
if(isset($item['id']) && ($items =& Members::list_editors_for_member('section:'.$item['id'], 0, USERS_LIST_SIZE, 'comma')))
$input =& Skin::build_list($items, 'comma');
else
$input = i18n::s('No editor has been assigned to this section.');
if(isset($item['id'])) {
// allow to involve more persons
$input .= ' <span class="details">'.Skin::build_link(Sections::get_url($item['id'], 'invite'), i18n::s('Invite participants'), 'button').'</span>';
// only real owner can manage editors
if(Sections::is_owned($item, $anchor, TRUE) || Surfer::is_associate())
$input .= ' <span class="details">'.Skin::build_link(Users::get_url('section:'.$item['id'], 'select'), i18n::s('Manage editors'), 'button').'</span>';
}
$fields[] = array($label, $input);
// readers
$label = i18n::s('Readers');
if(isset($item['id']) && ($items =& Members::list_readers_by_name_for_member('section:'.$item['id'], 0, 30, 'comma')))
$input =& Skin::build_list($items, 'comma');
else
$input = i18n::s('No reader has been assigned to this section.');
$fields[] = array($label, $input);
}
// the active flag: Yes/public, Restricted/logged, No/associates --we don't care about inheritance, to enable security changes afterwards
$label = i18n::s('Access');
// maybe a public page
$input = '<input type="radio" name="active_set" value="Y" accesskey="v"';
if(!isset($item['active_set']) || ($item['active_set'] == 'Y'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('Public - Everybody, including anonymous surfers').BR;
// maybe a restricted page
$input .= '<input type="radio" name="active_set" value="R"';
if(isset($item['active_set']) && ($item['active_set'] == 'R'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('Community - Access is granted to any identified surfer').BR;
// or a hidden page
$input .= '<input type="radio" name="active_set" value="N"';
if(isset($item['active_set']) && ($item['active_set'] == 'N'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('Private - Access is restricted to selected persons');
// combine this with inherited access right
if(is_object($anchor) && $anchor->is_hidden())
$hint = i18n::s('Parent is private, and this will be re-enforced anyway');
elseif(is_object($anchor) && !$anchor->is_public())
$hint = i18n::s('Parent is not public, and this will be re-enforced anyway');
else
$hint = i18n::s('Who is allowed to access?');
// expand the form
$fields[] = array($label, $input, $hint);
// locked: Yes / No
$label = i18n::s('Locker');
$input = '<input type="radio" name="locked" value="N"';
if(!isset($item['locked']) || ($item['locked'] != 'Y'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('Contributions are accepted').' '
.BR.'<input type="radio" name="locked" value="Y"';
if(isset($item['locked']) && ($item['locked'] == 'Y'))
$input .= ' checked="checked"';
if(isset($item['active']) && ($item['active'] == 'N'))
$input .= '/> '.i18n::s('Only owners and associates can add content');
else
$input .= '/> '.i18n::s('Only assigned persons, owners and associates can add content');
$fields[] = array($label, $input);
// append fields
$text .= Skin::build_form($fields);
$fields = array();
// settings for parent or site map
//
$parent = '';
// layout of the upper index page, or of the site map
//
if(is_object($anchor)) {
// define how this section appears
$input = i18n::s('This section should be:').BR
.'<input type="radio" name="index_map" value="Y"';
if(!isset($item['index_map']) || ($item['index_map'] == 'Y'))
$input .= ' checked="checked"';
$input .= '/> '.sprintf(i18n::s('listed in the main panel, with the rank %s (default value is 10000).'), '<input type="text" name="rank" size="5" value="'.encode_field(isset($item['rank']) ? $item['rank'] : '10000').'" maxlength="5" />');
$input .= BR.'<input type="radio" name="index_map" value="N"';
if(isset($item['index_map']) && ($item['index_map'] != 'Y'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('listed only to associates and editors, with other special sections').BR;
$parent .= '<p>'.$input.'</p>';
$input = i18n::s('Content of this section should be:').BR;
$input .= '<input type="radio" name="index_panel" value="main"';
if(!isset($item['index_panel']) || ($item['index_panel'] == '') || ($item['index_panel'] == 'main'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('displayed in the main panel')
.BR.'<input type="radio" name="index_panel" value="news"';
if(isset($item['index_panel']) && ($item['index_panel'] == 'news'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('displayed in the area reserved to news')
.BR.'<input type="radio" name="index_panel" value="gadget"';
if(isset($item['index_panel']) && ($item['index_panel'] == 'gadget'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('listed in the main panel, in a gadget box')
.BR.'<input type="radio" name="index_panel" value="gadget_boxes"';
if(isset($item['index_panel']) && ($item['index_panel'] == 'gadget_boxes'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('displayed in distinct gadget boxes')
.BR.'<input type="radio" name="index_panel" value="extra"';
if(isset($item['index_panel']) && ($item['index_panel'] == 'extra'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('listed on page side, in an extra box')
.BR.'<input type="radio" name="index_panel" value="extra_boxes"';
if(isset($item['index_panel']) && ($item['index_panel'] == 'extra_boxes'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('displayed in distinct extra boxes')
.BR.'<input type="radio" name="index_panel" value="none"';
if(isset($item['index_panel']) && ($item['index_panel'] == 'none'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('not displayed at the parent index page');
$parent .= '<p>'.$input.'</p>';
// layout options related to the site map
} else {
// associates may decide if the top-level section will be hidden on the site map or not
if(Surfer::is_associate()) {
// define how this section appear at the site map
$label= '';
$input = i18n::s('This section should be:').BR
.'<input type="radio" name="index_map" value="Y"';
if(!isset($item['index_map']) || ($item['index_map'] == 'Y'))
$input .= ' checked="checked"';
$input .= '/> '.sprintf(i18n::s('listed in the main panel, with the rank %s (default value is 10000).'), '<input type="text" name="rank" size="5" value="'.encode_field(isset($item['rank']) ? $item['rank'] : '10000').'" maxlength="5" />');
$input .= BR.'<input type="radio" name="index_map" value="N"';
if(isset($item['index_map']) && ($item['index_map'] != 'Y'))
$input .= ' checked="checked"';
$input .= '/> '.i18n::s('listed only to associates, with other special sections, and never appears at the site front page').BR;
$parent .= '<p>'.$label.BR.$input.'</p>';
// preserve previous settings
} else {
if(isset($item['index_map']))
$text .= '<input type="hidden" name="index_map" value="'.encode_field($item['index_map']).'" />';
if(isset($item['rank']))
$text .= '<input type="hidden" name="rank" value="'.encode_field($item['rank']).'" />';
}
}
// the thumbnail url may be set after the page has been created
if(isset($item['id'])) {
$label = i18n::s('Thumbnail');
$input = '';
$hint = '';
// show the current thumbnail
if(isset($item['thumbnail_url']) && $item['thumbnail_url']) {
$input .= '<img src="'.$item['thumbnail_url'].'" alt="" />'.BR;
$command = i18n::s('Change');
} elseif(Surfer::may_upload()) {
$hint .= i18n::s('Upload a small image to illustrate this page when it is listed into parent page.');
$command = i18n::s('Add an image');
}
$input .= '<input type="text" name="thumbnail_url" size="55" value="'.encode_field(isset($item['thumbnail_url']) ? $item['thumbnail_url'] : '').'" maxlength="255" />';
if(Surfer::may_upload())
$input .= ' <span class="details">'.Skin::build_link('images/edit.php?anchor='.urlencode('section:'.$item['id']).'&action=thumbnail', $command, 'button').'</span>';
$fields[] = array($label, $input, $hint);
}
// the activation date
$label = i18n::s('Activation date');
// adjust date from UTC time zone to surfer time zone
$value = '';
if(isset($item['activation_date']) && ($item['activation_date'] > NULL_DATE))
$value = Surfer::from_GMT($item['activation_date']);
$input = Skin::build_input('activation_date', $value, 'date_time');
$hint = i18n::s('Publish content in the future - automatically');
$fields[] = array($label, $input, $hint);
// the expiry date
$label = i18n::s('Expiry date');
// adjust date from UTC time zone to surfer time zone
$value = '';
if(isset($item['expiry_date']) && ($item['expiry_date'] > NULL_DATE))
$value = Surfer::from_GMT($item['expiry_date']);
$input = Skin::build_input('expiry_date', $value, 'date_time');
$hint = i18n::s('Remove content on dead-line - automatically');
$fields[] = array($label, $input, $hint);
// provide my id
$me = isset($item['id']) ? $item['id'] : NULL;
// reference to parent section
$ref = is_object($anchor) ? $anchor->get_reference(): NULL;
// associates can anchor the section anywhere
if(Surfer::is_associate()) {
$label = i18n::s('Section');
$input =& Skin::build_box(i18n::s('Select parent container'), Sections::get_radio_buttons($ref, $me), 'folded');
$fields[] = array($label, $input);
// parent section is defined and surfer is an editor of it
}elseif(is_object($anchor) && ($anchor->is_assigned())) {
$label = i18n::s('Section');
$input =& Skin::build_box(i18n::s('Select parent container'), Sections::get_radio_buttons($ref, $me), 'folded');
$fields[] = array($label, $input);
// preserve the existing anchor
} else
$text .= '<input type="hidden" name="anchor" value="'.$anchor->get_reference().'" />';