Parent Directory
|
Revision Log
++ ChangeLog 21 Jul 2008 05:20:07 -0000 * cc.cgi: Information sections are now handled by WebHACC::Input module. Input objects for subdocuments now owns their own subclass. 2008-07-21 Wakaba <wakaba@suika.fam.cx> ++ html/WebHACC/Language/ChangeLog 21 Jul 2008 05:24:27 -0000 * Base.pm: Use new method for node links. * CSS.pm: Typo fixes. Pass |input| object as an argument to the CSSOM validation not supported error. 2008-07-21 Wakaba <wakaba@suika.fam.cx> ++ html/WebHACC/ChangeLog 21 Jul 2008 05:23:21 -0000 * Input.pm: A new subclass for subdocuments are added. Methods for information sections are added (from cc.cgi). * Output.pm (code): Support for attributes. (script, dt): New methods. (node_link): New method (from get_node_link in WebHACC::Result, which comes from cc.cgi). * Result.pm (add_error): Show some text even if no location infomration is available. Use input object, if available, as fallback for location information. (get_error_label, get_node_path, get_node_link): Removed. The first method is no longer used. The latters are now supported as |node_link| method in WebHACC::Output. 2008-07-21 Wakaba <wakaba@suika.fam.cx>
| 1 | wakaba | 1.1 | package WebHACC::Input; |
| 2 | use strict; | ||
| 3 | |||
| 4 | sub new ($) { | ||
| 5 | wakaba | 1.3 | return bless {}, shift; |
| 6 | wakaba | 1.1 | } # new |
| 7 | |||
| 8 | wakaba | 1.3 | sub id_prefix ($) { '' } |
| 9 | |||
| 10 | sub nested ($) { 0 } | ||
| 11 | |||
| 12 | sub subdocument_index ($) { 0 } | ||
| 13 | |||
| 14 | sub generate_info_section ($$) { | ||
| 15 | my $self = shift; | ||
| 16 | |||
| 17 | my $result = shift; | ||
| 18 | my $out = $result->output; | ||
| 19 | |||
| 20 | $out->start_section (id => 'document-info', title => 'Information'); | ||
| 21 | $out->start_tag ('dl'); | ||
| 22 | |||
| 23 | $out->dt ('Request URL'); | ||
| 24 | $out->start_tag ('dd'); | ||
| 25 | $out->url ($self->{request_uri}); | ||
| 26 | |||
| 27 | $out->dt ('Document URL'); ## TODO: HTML5 "document's address"? | ||
| 28 | $out->start_tag ('dd'); | ||
| 29 | $out->url ($self->{uri}, id => 'anchor-document-url'); | ||
| 30 | $out->script (q[ | ||
| 31 | document.title = '<' | ||
| 32 | + document.getElementById ('anchor-document-url').href + '> \\u2014 ' | ||
| 33 | + document.title; | ||
| 34 | ]); | ||
| 35 | |||
| 36 | if (defined $self->{s}) { | ||
| 37 | $out->dt ('Base URL'); | ||
| 38 | $out->start_tag ('dd'); | ||
| 39 | $out->url ($self->{base_uri}); | ||
| 40 | |||
| 41 | $out->dt ('Internet Media Type'); | ||
| 42 | $out->start_tag ('dd'); | ||
| 43 | $out->code ($self->{media_type}, class => 'MIME', lang => 'en'); | ||
| 44 | if ($self->{media_type_overridden}) { | ||
| 45 | $out->html (' <em>(overridden)</em>'); | ||
| 46 | } elsif (defined $self->{official_type}) { | ||
| 47 | if ($self->{media_type} eq $self->{official_type}) { | ||
| 48 | # | ||
| 49 | } else { | ||
| 50 | $out->html (' <em>(sniffed; official type is: '); | ||
| 51 | $out-> |