/[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 968 by dpavlin, Fri Jan 9 14:52:58 2009 UTC revision 1064 by dpavlin, Mon Apr 27 18:40:41 2009 UTC
# Line 7  use Data::Dump qw/dump/; Line 7  use Data::Dump qw/dump/;
7  use Carp qw/confess cluck carp/;  use Carp qw/confess cluck carp/;
8  use File::Slurp;  use File::Slurp;
9  use Text::Tabs; # expand, unexpand  use Text::Tabs; # expand, unexpand
10    use Digest::MD5 qw/md5/;
11    
12  use lib 'lib';  use lib 'lib';
13    
# Line 193  sub add_head { Line 194  sub add_head {
194    
195  }  }
196    
197    my $seen;
198    
199  sub _add_css_js {  sub _add_css_js {
200          my ( $self, $what, $content ) = @_;          my ( $self, $what, $content ) = @_;
201    
202            my $md5 = md5( $content );
203            return if $seen->{$what}->{$md5}++;
204    
205          my $tag  = $what eq 'css' ? 'style'    : 'script';          my $tag  = $what eq 'css' ? 'style'    : 'script';
206          my $type = $what eq 'css' ? 'text/css' : 'text/javascript';          my $type = $what eq 'css' ? 'text/css' : 'text/javascript';
207          my $head;          my $head;
# Line 203  sub _add_css_js { Line 209  sub _add_css_js {
209          my ( $package, $path, $line ) = caller(1);          my ( $package, $path, $line ) = caller(1);
210    
211          $content = "/$content" if $content !~ m{[\n\r]} && -e $content;          $content = "/$content" if $content !~ m{[\n\r]} && -e $content;
212          if ( $content =~ $re_html ) {          if ( $content =~ $re_html && $what ne 'js' ) {
213                  $head = qq|                  $head = qq|
214                          $content                          $content
215                          <!-- $type via $package at $path line $line -->                          <!-- $type via $package at $path line $line -->
# Line 299  sub html_page { Line 305  sub html_page {
305    
306          my $right =          my $right =
307                  qq|                  qq|
308                          <span class="right">                          <span class="frey-status-right">
309                          <a title="reload $url"  href="/reload$url">reload</a>                          <a title="reload $url"  href="/reload$url">reload</a>
310                          <a title="$description" href="/exit$url" target="exit">$exit</a>                          <a title="$description" href="/exit$url" target="exit">$exit</a>
311                          </span>                          </span>
# Line 320  sub html_page { Line 326  sub html_page {
326    
327  #       $title =~ s{(\w)\w+::}{$1:}g; # XXX compress names of classes  #       $title =~ s{(\w)\w+::}{$1:}g; # XXX compress names of classes
328    
329            $self->add_css(qq|
330                    body {
331                            padding-bottom: 3em; /* don't overlap status line */
332                    }
333            |);
334    
335          my $html = join("\n",          my $html = join("\n",
336                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,
337                  $self->_head_html,                  $self->_head_html,

Legend:
Removed from v.968  
changed lines
  Added in v.1064

  ViewVC Help
Powered by ViewVC 1.1.26