/[Frey]/trunk/lib/Frey/Web.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/Web.pm

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

revision 418 by dpavlin, Tue Nov 18 16:54:10 2008 UTC revision 444 by dpavlin, Wed Nov 19 02:52:42 2008 UTC
# Line 25  has 'status' => ( Line 25  has 'status' => (
25          lazy => 1,          lazy => 1,
26          default => sub { [          default => sub { [
27                  { 'Bookmarklets' => Frey::Bookmarklet->new->markup },                  { 'Bookmarklets' => Frey::Bookmarklet->new->markup },
28                  { 'ClassBrowser' => Frey::ClassBrowser->new->markup },                  { 'ClassBrowser' => Frey::ClassBrowser->new( usage_on_top => 0 )->markup },
29          ] },          ] },
30  );  );
31    
# Line 81  sub _head_html { Line 81  sub _head_html {
81                          $out .= $self->_inline_path( $path ) ?                          $out .= $self->_inline_path( $path ) ?
82                                  qq|<!-- $path --><style type="text/css">\n| . read_file( $path ) . qq|\n</style>| :                                  qq|<!-- $path --><style type="text/css">\n| . read_file( $path ) . qq|\n</style>| :
83                                  qq|<link type="text/css" rel="stylesheet" href="/$path" media="screen">|;                                  qq|<link type="text/css" rel="stylesheet" href="/$path" media="screen">|;
84                    } elsif ( $path =~ m{<.+>} ) {
85                            $out .= $path;
86                  } else {                  } else {
87                          confess "don't know how to render $path";                          confess "don't know how to render $path";
88                  }                  }
# Line 102  sub add_head { Line 104  sub add_head {
104          return if ! defined $path || $path eq '';          return if ! defined $path || $path eq '';
105          $path =~ s!^/!!;          $path =~ s!^/!!;
106    
107          if ( -e $path ) {          if ( $path =~ m{<.*>} ) {
108                    push @{ $self->head }, $path;
109            } elsif ( -e $path ) {
110                  if ( $path =~ m/\.(?:js|css)$/ ) {                  if ( $path =~ m/\.(?:js|css)$/ ) {
111                          push @{ $self->head }, $path;                          push @{ $self->head }, $path;
112                  } else {                  } else {
113                          confess "can't add_head( $path ) it's not js or css";                          confess "can't add_head( $path ) it's not js or css";
114                  }                  }
115                    return -s $path;
116          } else {          } else {
117                  confess "can't find $path: $!";                  confess "can't find $path: $!";
118          }          }
119    
         return -s $path;  
120  }  }
121    
122  our $reload_counter = 0;  our $reload_counter = 0;
# Line 136  sub page { Line 140  sub page {
140    
141          my $status_line = '';          my $status_line = '';
142          foreach my $part ( @{ $self->status } ) {          foreach my $part ( @{ $self->status } ) {
143                  confess "part not hash ",dump( $part ) unless ref($part) eq 'HASH';                  if ( ref($part) ne 'HASH' ) {
144                            warn "part not hash ",dump( $part ) ;
145                            #$self->status( $part );
146                            next;
147                    }
148                  foreach my $name ( keys %$part ) {                  foreach my $name ( keys %$part ) {
149                          my $content = $part->{$name};                          my $content = $part->{$name};
150                          if ( ref($content) ) {                          if ( ref($content) ) {
# Line 151  sub page { Line 159  sub page {
159                  }                  }
160          }          }
161    
162            my $url = $self->request_url;
163            $url =~ s{\?reload=\d+}{};
164    
165          my $html = join("\n",          my $html = join("\n",
166                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,
167                  $self->_head_html,                  $self->_head_html,
# Line 162  sub page { Line 173  sub page {
173                  qq|                  qq|
174                  <div class="frey-status-line">                  <div class="frey-status-line">
175                          <a href="/">Frey</a> $Frey::VERSION                          <a href="/">Frey</a> $Frey::VERSION
176                          <a href="?reload=$reload_counter"><code>| . $self->request_url . qq|</code></a>                          <a href="?reload=$reload_counter"><code>$url</code></a>
177                          $status_line                          $status_line
178                  </div>                  </div>
179              </body></html>              </body></html>

Legend:
Removed from v.418  
changed lines
  Added in v.444

  ViewVC Help
Powered by ViewVC 1.1.26