104 |
sub start_section ($%) { |
sub start_section ($%) { |
105 |
my ($self, %opt) = @_; |
my ($self, %opt) = @_; |
106 |
|
|
107 |
|
my $class = 'section'; |
108 |
if (defined $opt{role}) { |
if (defined $opt{role}) { |
109 |
if ($opt{role} eq 'parse-errors') { |
if ($opt{role} eq 'parse-errors') { |
110 |
$opt{id} ||= 'parse-errors'; |
$opt{id} ||= 'parse-errors'; |
131 |
$opt{title} ||= 'Document Structure'; |
$opt{title} ||= 'Document Structure'; |
132 |
$opt{short_title} ||= 'Structure'; |
$opt{short_title} ||= 'Structure'; |
133 |
delete $opt{role}; |
delete $opt{role}; |
134 |
|
} elsif ($opt{role} eq 'subdoc') { |
135 |
|
$class .= ' subdoc'; |
136 |
|
delete $opt{role}; |
137 |
} |
} |
138 |
} |
} |
139 |
|
|
140 |
$self->{section_rank}++; |
$self->{section_rank}++; |
141 |
$self->html ('<div class=section'); |
$self->html (qq[<div class="$class"]); |
142 |
if (defined $opt{id}) { |
if (defined $opt{id}) { |
143 |
my $id = $self->input->id_prefix . $opt{id}; |
my $prefix = $self->input->id_prefix; |
144 |
$self->html (' id="' . $htescape->($id) . '"'); |
$opt{parent_id} ||= $prefix; |
145 |
push @{$self->{nav}}, |
my $id = $prefix . $opt{id}; |
146 |
[$id => $opt{short_title} || $opt{title} => $opt{text}] |
$self->html (' id="' . $htescape->($id) . '">'); |
147 |
if $self->{section_rank} == 2; |
if ($self->{section_rank} == 2 or length $opt{parent_id}) { |
148 |
|
my $st = $opt{short_title} || $opt{title}; |
149 |
|
push @{$self->{nav}}, |
150 |
|
[$id => $st => $opt{text}]; |
151 |
|
|
152 |
|
$self->start_tag ('script'); |
153 |
|
$self->html (qq[ addSectionLink ('$id', ']); |
154 |
|
$self->nl_text ($st, text => $opt{text}); |
155 |
|
if (defined $opt{parent_id}) { |
156 |
|
$self->html (q[', '] . $opt{parent_id}); |
157 |
|
} |
158 |
|
$self->html (q[') ]); |
159 |
|
$self->end_tag ('script'); |
160 |
|
} |
161 |
|
} else { |
162 |
|
$self->html ('>'); |
163 |
} |
} |
164 |
my $section_rank = $self->{section_rank}; |
my $section_rank = $self->{section_rank}; |
165 |
$section_rank = 6 if $section_rank > 6; |
$section_rank = 6 if $section_rank > 6; |
166 |
$self->html ('><h' . $section_rank . '>'); |
$self->html ('<h' . $section_rank . '>'); |
167 |
$self->nl_text ($opt{title}, text => $opt{text}); |
$self->nl_text ($opt{title}, text => $opt{text}); |
168 |
$self->html ('</h' . $section_rank . '>'); |
$self->html ('</h' . $section_rank . '>'); |
169 |
} # start_section |
} # start_section |
450 |
<link rel="stylesheet" href="../cc-style.css" type="text/css"> |
<link rel="stylesheet" href="../cc-style.css" type="text/css"> |
451 |
<script src="../cc-script.js"></script> |
<script src="../cc-script.js"></script> |
452 |
</head> |
</head> |
453 |
<body> |
<body onclick=" return onbodyclick (event) " onload=" onbodyload () "> |
454 |
<h1>]); |
<h1>]); |
455 |
$self->nl_text (q[WebHACC:Heading]); |
$self->nl_text (q[WebHACC:Heading]); |
456 |
$self->html ('</h1>'); |
$self->html (q[</h1><script> insertNavSections () </script>]); |
457 |
} # html_header |
} # html_header |
458 |
|
|
459 |
sub generate_input_section ($$) { |
sub generate_input_section ($$) { |
462 |
my $options = sub ($) { |
my $options = sub ($) { |
463 |
my $context = shift; |
my $context = shift; |
464 |
|
|
465 |
$out->html (q[<div class=details><p class=legend onclick="nextSibling.style.display = nextSibling.style.display == 'none' ? 'block' : 'none'">]); |
$out->html (q[<div class="details default"><p class=legend onclick="nextSibling.style.display = nextSibling.style.display == 'block' ? 'none' : 'block'; parentNode.className = nextSibling.style.display == 'none' ? 'details' : 'details open'">]); |
466 |
$out->nl_text (q[Options]); |
$out->nl_text (q[Options]); |
467 |
$out->start_tag ('div'); |
$out->start_tag ('div'); |
468 |
|
|
540 |
}; # $options |
}; # $options |
541 |
|
|
542 |
$out->start_section (id => 'input', title => 'Input'); |
$out->start_section (id => 'input', title => 'Input'); |
543 |
|
$out->html (q[<script> insertNavSections ('input') </script>]); |
544 |
|
|
545 |
$out->start_section (id => 'input-url', title => 'By URL'); |
$out->start_section (id => 'input-url', title => 'By URL', |
546 |
|
parent_id => 'input'); |
547 |
$out->start_tag ('form', action => './#result-summary', |
$out->start_tag ('form', action => './#result-summary', |
548 |
'accept-charset' => 'utf-8', |
'accept-charset' => 'utf-8', |
549 |
method => 'get'); |
method => 'get'); |
559 |
value => $cgi->get_parameter ('uri')); |
value => $cgi->get_parameter ('uri')); |
560 |
$out->end_tag ('label'); |
$out->end_tag ('label'); |
561 |
|
|
|
$options->('url'); |
|
|
|
|
562 |
$out->start_tag ('p'); |
$out->start_tag ('p'); |
563 |
$out->start_tag ('button', type => 'submit'); |
$out->start_tag ('button', type => 'submit'); |
564 |
$out->nl_text ('Check'); |
$out->nl_text ('Check'); |
565 |
|
$out->end_tag ('button'); |
566 |
|
|
567 |
|
$options->('url'); |
568 |
|
|
569 |
$out->end_tag ('form'); |
$out->end_tag ('form'); |
570 |
$out->end_section; |
$out->end_section; |
573 |
|
|
574 |
## TODO: File upload |
## TODO: File upload |
575 |
|
|
576 |
$out->start_section (id => 'input-text', title => 'By direct input'); |
$out->start_section (id => 'input-text', title => 'By direct input', |
577 |
|
parent_id => 'input'); |
578 |
$out->start_tag ('form', action => './#result-summary', |
$out->start_tag ('form', action => './#result-summary', |
579 |
'accept-charset' => 'utf-8', |
'accept-charset' => 'utf-8', |
580 |
method => 'post'); |
method => 'post'); |
592 |
$out->end_tag ('textarea'); |
$out->end_tag ('textarea'); |
593 |
$out->end_tag ('label'); |
$out->end_tag ('label'); |
594 |
|
|
|
$options->('text'); |
|
|
|
|
595 |
$out->start_tag ('p'); |
$out->start_tag ('p'); |
596 |
$out->start_tag ('button', type => 'submit', |
$out->start_tag ('button', type => 'submit', |
597 |
onclick => 'form.method = form.s.value.length > 512 ? "post" : "get"'); |
onclick => 'form.method = form.s.value.length > 512 ? "post" : "get"'); |
598 |
$out->nl_text ('Check'); |
$out->nl_text ('Check'); |
599 |
$out->end_tag ('button'); |
$out->end_tag ('button'); |
600 |
|
|
601 |
|
$options->('text'); |
602 |
|
|
603 |
$out->end_tag ('form'); |
$out->end_tag ('form'); |
604 |
$out->end_section; |
$out->end_section; |
605 |
|
|
606 |
|
$out->script (q[ |
607 |
|
if (!document.webhaccNavigated && |
608 |
|
document.getElementsByTagName ('textarea')[0].value.length > 0) { |
609 |
|
showTab ('input-text'); |
610 |
|
document.webhaccNavigated = false; |
611 |
|
} |
612 |
|
]); |
613 |
|
|
614 |
$out->end_section; |
$out->end_section; |
615 |
} # generate_input_section |
} # generate_input_section |
616 |
|
|