/[Frey]/branches/zimbardo/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 /branches/zimbardo/lib/Frey/Web.pm

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

revision 528 by dpavlin, Wed Nov 26 02:35:59 2008 UTC revision 529 by dpavlin, Wed Nov 26 04:26:43 2008 UTC
# Line 320  sub status_parts { Line 320  sub status_parts {
320    
321  sub DEMOLISH {  sub DEMOLISH {
322          my ( $self ) = @_;          my ( $self ) = @_;
323          cluck "## DEMOLISH status ", $#status + 1, " elements ", dump( map { keys %$_ } @status ) if @status;          warn "## $self DEMOLISH status ", $#status + 1, " elements ", dump( map { keys %$_ } @status ) if @status;
324  }  }
325    
326  =head2 add_icon  =head2 add_icon
# Line 330  sub DEMOLISH { Line 330  sub DEMOLISH {
330    
331  =cut  =cut
332    
333  sub add_icon {  sub icon_path {
334          my ($self,$name) = @_;          my ($self,$class,$variant) = @_;
335          my $icon = ref($self);          my $icon = $class;
         $icon = $self->class if $self->can('class');  
336          $icon =~ s{::}{/}g;          $icon =~ s{::}{/}g;
337          $icon .= "/$name" if $name;          $icon .= "/$variant" if $variant;
338            my $path = 'static/icons/' . $icon . '.png';
339            if ( -e $path ) {
340                    warn "# $class from $self icon_path $path";
341                    return $path;
342            } else {
343                    warn "TODO: add $path icon for $class";
344                    return undef;
345            }
346    }
347    
348          my $icon_path = "static/icons/$icon.png";  sub add_icon {
349            my ($self,$variant) = @_;
350    
351          if ( -e $icon_path ) {          my $class = ref($self);
352                  $icon_html .= qq|<link rel="icon" type="image/png" href="/$icon_path">|;          $class = $self->class if $self->can('class');
353                  warn "# using icon $icon_path";          my $icon_path = $self->icon_path( $class, $variant ) || return;
354    
355            $icon_html .= qq|<link rel="icon" type="image/png" href="/$icon_path">|;
356            warn "# using icon $icon_path";
357    
358  =for later  =for later
359    
360                  # FIXME http://en.wikipedia.org/wiki/Favicon suggest just rel="icon" but that doesn't seem to work!          # FIXME http://en.wikipedia.org/wiki/Favicon suggest just rel="icon" but that doesn't seem to work!
361                  my $ico_path = $icon_path;          my $ico_path = $icon_path;
362                  $ico_path =~ s{png$}{ico};          $ico_path =~ s{png$}{ico};
363                  if ( ! -e $ico_path ) {          if ( ! -e $ico_path ) {
364                          system "convert $icon_path $ico_path";                  system "convert $icon_path $ico_path";
365                          warn "# convert $icon_path $ico_path : $@";                  warn "# convert $icon_path $ico_path : $@";
366                  }          }
367                  $icon_html .= qq|<link rel="shortcut icon" type="image/x-icon" href="/$ico_path">| if -e $ico_path;          $icon_html .= qq|<link rel="shortcut icon" type="image/x-icon" href="/$ico_path">| if -e $ico_path;
368    
369  =cut  =cut
370    
         } else {  
                 warn "TODO add $icon_path icon";  
         }  
371  }  }
372    
373  1;  1;

Legend:
Removed from v.528  
changed lines
  Added in v.529

  ViewVC Help
Powered by ViewVC 1.1.26