/[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 523 by dpavlin, Tue Nov 25 17:15:18 2008 UTC revision 524 by dpavlin, Wed Nov 26 00:45:52 2008 UTC
# Line 220  sub page { Line 220  sub page {
220          my $revision = Frey::SVK->info->{Revision} || '';          my $revision = Frey::SVK->info->{Revision} || '';
221          $revision = $1 if $info->{'Mirrored From'} =~ m{Rev\.\s+(\d+)};          $revision = $1 if $info->{'Mirrored From'} =~ m{Rev\.\s+(\d+)};
222    
223            $self->add_icon;
224    
225          my $html = join("\n",          my $html = join("\n",
226                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,
227                  $self->_head_html,                  $self->_head_html,
# Line 317  sub DEMOLISH { Line 319  sub DEMOLISH {
319          cluck "## DEMOLISH status ", $#status + 1, " elements ", dump( map { keys %$_ } @status ) if @status;          cluck "## DEMOLISH status ", $#status + 1, " elements ", dump( map { keys %$_ } @status ) if @status;
320  }  }
321    
322    sub add_icon {
323            my $self = shift;
324            my $icon = ref($self);
325            $icon = $self->class if $self->can('class');
326            $icon =~ s{::}{/}g;
327    
328            my $icon_path = "static/icons/$icon.png";
329    
330            if ( -e $icon_path ) {
331                    $self->add_head( qq|<link rel="icon" type="image/png" href="/$icon_path" />| );
332                    warn "# using icon $icon_path";
333    
334                    # FIXME http://en.wikipedia.org/wiki/Favicon suggest just rel="icon" but that doesn't seem to work!
335                    my $ico_path = $icon_path;
336                    $ico_path =~ s{png$}{ico};
337                    if ( ! -e $ico_path ) {
338                            system "convert $icon_path $ico_path";
339                            warn "# convert $icon_path $ico_path : $@";
340                    }
341                    $self->add_head( qq|<link rel="shortcut icon" type="image/x-icon" href="/$ico_path" />| ) if -e $ico_path;
342    
343            } else {
344                    warn "can't find $icon_path";
345            }
346    }
347    
348  1;  1;

Legend:
Removed from v.523  
changed lines
  Added in v.524

  ViewVC Help
Powered by ViewVC 1.1.26