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

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

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

revision 1.9 by wakaba, Thu Aug 14 15:50:42 2008 UTC revision 1.19 by wakaba, Thu Sep 11 09:13:57 2008 UTC
# Line 52  sub add_error ($%) { Line 52  sub add_error ($%) {
52    my ($self, %opt) = @_;    my ($self, %opt) = @_;
53    
54    my $out = $self->output;    my $out = $self->output;
55      $out->has_error (1);
56    
57    my $error_level = $opt{level};    my $error_level = $opt{level};
58    if (not defined $error_level) {    if (not defined $error_level) {
# Line 80  sub add_error ($%) { Line 81  sub add_error ($%) {
81      $error_layer = 'syntax'; ## NOTE: Unknown - an error of the implementation      $error_layer = 'syntax'; ## NOTE: Unknown - an error of the implementation
82    }    }
83    
   my $error_type_text = $opt{type};  
   
84    my $class = qq[level-$error_level layer-$error_layer];    my $class = qq[level-$error_level layer-$error_layer];
85    
86    ## Line & column numbers (prepare values)    ## Line & column numbers (prepare values)
# Line 171  sub add_error ($%) { Line 170  sub add_error ($%) {
170    
171    if (defined $opt{value}) {    if (defined $opt{value}) {
172      $out->html (' ');      $out->html (' ');
173      $out->code ($opt{value});      if (defined $opt{pos_start}) {
174          $out->start_tag ('code');
175          $out->text (substr $opt{value}, 0, $opt{pos_start});
176          $out->start_tag ('mark');
177          $out->text (substr $opt{value}, $opt{pos_start},
178                          $opt{pos_end} - $opt{pos_start} + 1);
179          $out->end_tag ('mark');
180          $out->text (substr $opt{value}, $opt{pos_end} + 1)
181              if $opt{pos_end} < length $opt{value};
182          $out->end_tag ('code');
183        } elsif ($opt{value_mark_end}) {
184          $out->start_tag ('code');
185          $out->text ($opt{value});
186          $out->start_tag ('mark');
187          $out->end_tag ('mark');
188          $out->end_tag ('code');
189        } elsif (defined $opt{value_mark}) {
190          $out->start_tag ('code');
191          for (split /($opt{value_mark})/, $opt{value}) {
192            if (/$opt{value_mark}/) {
193              $out->start_tag ('mark');
194              $out->text ($_);
195              $out->end_tag ('mark');
196            } else {
197              $out->text ($_);
198            }
199          }
200          $out->end_tag ('code');
201        } else {
202          $out->code ($opt{value});
203        }
204      $has_location = 1;      $has_location = 1;
205    }    }
206    
# Line 186  sub add_error ($%) { Line 215  sub add_error ($%) {
215        } elsif (defined $opt{input}->{request_uri}) {        } elsif (defined $opt{input}->{request_uri}) {
216          $out->url ($opt{input}->{request_uri});          $out->url ($opt{input}->{request_uri});
217          $has_location = 1;          $has_location = 1;
218        } elsif (defined $opt{input}->{uri}) {        } elsif (defined $opt{input}->url) {
219          $out->url ($opt{input}->{uri});          $out->url ($opt{input}->url);
220          $has_location = 1;          $has_location = 1;
221        }        }
222      }      }
223            
224      unless ($has_location) {      unless ($has_location) {
225        $out->text ('Unknown location');        $out->nl_text ('Unknown location');
226      }      }
227    }    }
228    
# Line 204  sub add_error ($%) { Line 233  sub add_error ($%) {
233    $out->text (': ');    $out->text (': ');
234        
235    ## Error message    ## Error message
236    $out->nl_text ($error_type_text, node => $opt{node}, text => $opt{text});    my $error_type_text = $opt{type};
237      $out->nl_text ($error_type_text, node => $opt{node}, text => $opt{text},
238    ## Additional error description                   value => $opt{value}, char => $opt{char},
239    if (defined $opt{text}) {                   octets => $opt{octets});
     $out->html (' (<q>');  
     $out->text ($opt{text});  
     $out->html ('</q>)');  
   }  
240        
241    ## Link to a long description    ## Link to a long description
242    
# Line 219  sub add_error ($%) { Line 244  sub add_error ($%) {
244    $fragment =~ tr/ /-/;    $fragment =~ tr/ /-/;
245    $fragment = $out->encode_url_component ($fragment);    $fragment = $out->encode_url_component ($fragment);
246    $out->text (' [');    $out->text (' [');
247    $out->link ('Description', url => '../error-description#' . $fragment,    $out->start_tag ('a', href => '../error-description#' . $fragment,
248                rel => 'help');                     rel => 'help');
249      $out->nl_text ('Description');
250      $out->end_tag ('a');
251    $out->text (']');    $out->text (']');
252    
253    if ($error_level eq 'm') {    if ($error_level eq 'm') {
# Line 287  sub generate_result_section ($) { Line 314  sub generate_result_section ($) {
314        $out->start_tag ('th', colspan => 7, scope => 'col');        $out->start_tag ('th', colspan => 7, scope => 'col');
315        $out->nl_text ('Main document');        $out->nl_text ('Main document');
316      },      },
317        {label => 'Transfer', status => $self->{layers}->{transfer},        {label => 'Transfer L.', status => $self->{layers}->{transfer},
318         target => 'transfer-errors', score_base => 20,         target => 'transfer-errors', score_base => 20,
319         parent_status => $maindoc_status},         parent_status => $maindoc_status},
320        {label => 'Encode', status => $self->{layers}->{encode},        {label => 'Encode L.', status => $self->{layers}->{encode},
321         score_base => 10,         target => 'parse-errors', score_base => 10,
322         parent_status => $maindoc_status},         parent_status => $maindoc_status},
323        {label => 'Charset', status => $self->{layers}->{charset},        {label => 'Char L.', status => $self->{layers}->{charset},
324         score_base => 10,         target => 'parse-errors', score_base => 10,
325         parent_status => $maindoc_status},         parent_status => $maindoc_status},
326        {label => 'Syntax', status => $self->{layers}->{syntax},        ## TODO: char semantics layer
327          {label => 'Syntax L.', status => $self->{layers}->{syntax},
328         target => 'parse-errors', score_base => 20,         target => 'parse-errors', score_base => 20,
329         parent_status => $maindoc_status},         parent_status => $maindoc_status},
330        {label => 'Structure', status => $self->{layers}->{structure},        {label => 'Structure L.', status => $self->{layers}->{structure},
331         target => 'document-errors', score_base => 20,         target => 'document-errors', score_base => 20,
332         parent_status => $maindoc_status},         parent_status => $maindoc_status},
333        {label => 'Semantics', status => $self->{layers}->{semantics},        {label => 'Semantics L.', status => $self->{layers}->{semantics},
334         score_base => 20,         score_base => 20,
335         parent_status => $maindoc_status},         parent_status => $maindoc_status},
336    );    );

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.19

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24