/[suikacvs]/test/html-webhacc/WebHACC/Output.pm
Suika

Diff of /test/html-webhacc/WebHACC/Output.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by wakaba, Sun Aug 10 11:49:43 2008 UTC revision 1.13 by wakaba, Thu Aug 14 09:16:52 2008 UTC
# Line 104  sub end_tag ($$) { Line 104  sub end_tag ($$) {
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';
# Line 130  sub start_section ($%) { Line 131  sub start_section ($%) {
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        $opt{parent_id} ||= $prefix;
145        my $id = $prefix . $opt{id};
146      $self->html (' id="' . $htescape->($id) . '">');      $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};        my $st = $opt{short_title} || $opt{title};
149        push @{$self->{nav}},        push @{$self->{nav}},
150            [$id => $st => $opt{text}];            [$id => $st => $opt{text}];
151                
152        $self->start_tag ('script');        $self->start_tag ('script');
153        $self->html (qq[ addSectionLink ('] . $self->input->id_prefix .        $self->html (qq[ addSectionLink ('$id', ']);
                      qq[$id', ']);  
154        $self->nl_text ($st, text => $opt{text});        $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[') ]);        $self->html (q[') ]);
159        $self->end_tag ('script');        $self->end_tag ('script');
160      }      }
# Line 454  sub generate_input_section ($$) { Line 462  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    
# Line 532  sub generate_input_section ($$) { Line 540  sub generate_input_section ($$) {
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');
# Line 549  sub generate_input_section ($$) { Line 559  sub generate_input_section ($$) {
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;
# Line 562  sub generate_input_section ($$) { Line 573  sub generate_input_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');
# Line 580  sub generate_input_section ($$) { Line 592  sub generate_input_section ($$) {
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    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.13

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24