1
# See bottom of file for license and copyright information
3
# A UI for a collection object, designed so the objects can be twisted.
4
# The UI is implemented by visiting the nodes of the configuration and
5
# invoking the open-html and close_html methods for each node. The
6
# layout of a configuration page is depth-sensitive, so we have slightly
7
# different behaviours for each of level 0 (the root), level 1 (twisty
8
# sections) and level > 1 (subsection).
9
package Foswiki::Configure::UIs::Section;
10
use base 'Foswiki::Configure::UI';
14
# depth == 1 is the root
15
# depth == 2 are twisty sections
16
# depth > 2 are subsections
18
my ( $this, $section, $valuer, $expert ) = @_;
20
my $depth = $section->getDepth();
24
# A running section has no subtable, just a header row
25
if ( !$expert && $section->isExpertsOnly() ) {
29
my $fn = 'CGI::h' . $depth;
31
my $head = &$fn( $section->{headline} );
33
$head .= $section->{desc} if $section->{desc};
34
return '<tr><td colspan="2">' . $head . '</td></tr>';
38
my $id = $this->_makeAnchor( $section->{headline} );
39
my $linkId = 'blockLink' . $id;
40
my $linkAnchor = $id . 'link';
42
my $mess = $this->collectMessages($section);
44
my $guts = "<!-- $depth $section->{headline} -->";
48
$guts .= '<tr><td colspan="2">';
49
$guts .= CGI::a( { name => $linkAnchor } );
55
class => 'blockLink blockLinkOff',
56
href => '#' . $linkAnchor,
58
onclick => 'foldBlock("' . $id . '"); return false;'
60
'<span class="blockLinkIndicator"></span>' . $section->{headline} . $mess
63
$guts .= "<div id='$id' class='foldableBlock foldableBlockClosed'>";
67
$guts .= CGI::start_table(
76
# Put info text inside table row for visual consistency
80
{ colspan => "2", class => 'docdata firstInfo' },
83
) if $section->{desc};
90
my ( $this, $section, $expert ) = @_;
91
my $depth = $section->getDepth();
103
$end .= '</td></tr>';
106
return "$end<!-- /$depth $section->{headline} -->\n";
113
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
115
# Copyright (C) 2008 Foswiki Contributors. All Rights Reserved.
116
# Foswiki Contributors are listed in the AUTHORS file in the root
117
# of this distribution. NOTE: Please extend that file, not this notice.
119
# Additional copyrights apply to some or all of the code in this
122
# Copyright (C) 2000-2006 TWiki Contributors. All Rights Reserved.
123
# TWiki Contributors are listed in the AUTHORS file in the root
124
# of this distribution. NOTE: Please extend that file, not this notice.
126
# This program is free software; you can redistribute it and/or
127
# modify it under the terms of the GNU General Public License
128
# as published by the Free Software Foundation; either version 2
129
# of the License, or (at your option) any later version. For
130
# more details read LICENSE in the root of this distribution.
132
# This program is distributed in the hope that it will be useful,
133
# but WITHOUT ANY WARRANTY; without even the implied warranty of
134
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
136
# As per the GPL, removal of this notice is prohibited.