/[Frey]/trunk/lib/Frey/Class/Icon.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/Class/Icon.pm

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

revision 1128 by dpavlin, Mon Jun 29 16:54:02 2009 UTC revision 1129 by dpavlin, Tue Jun 30 14:13:56 2009 UTC
# Line 20  sub icon_path { Line 20  sub icon_path {
20          sub icon_exists {          sub icon_exists {
21                  my $class = shift;                  my $class = shift;
22                  $class =~ s{::}{/}g;                  $class =~ s{::}{/}g;
23                  $class .= "/$variant" if $variant;                  $class .= '/' . $variant if $variant;
24                  my $icon_path = 'static/icons/' . $class . '.png';                  my $icon_path = 'static/icons/' . $class . '.png';
25                  return $icon_path if -e $icon_path;                  return $icon_path if -e $icon_path;
26                  return;                  return;
# Line 43  sub icon_path { Line 43  sub icon_path {
43          return $path;          return $path;
44  }  }
45    
 our $icon_html;  
 sub icon_html { $icon_html };  
   
46  sub add_icon {  sub add_icon {
47          my ($self,$variant) = @_;          my ($self,$variant) = @_;
48    
49          my $class = $self->class if $self->can('class');          my $class = $self->class if $self->can('class');
50          #$class ||= $self->title;          #$class ||= $self->title;
51          $class ||= ref($self);          $class ||= ref($self);
52          my $icon_path = $self->icon_path( $class, $variant ) || return;  warn "XXXXX class: $class";
53            my $icon_path = $self->icon_path( $class, $variant );
54            if ( ! -e $icon_path ) {
55                    warn "FIXME icon $class $variant";
56                    $self->icon_html( qq|<!-- no icon for $class -->| );
57                    return;
58            }
59    
60          $icon_html .= qq|<link rel="icon" type="image/png" href="/$icon_path">|;          $self->icon_html( qq|<link rel="icon" type="image/png" href="/$icon_path">| );
61          warn "# using icon $icon_path for $class $variant ";          warn "# using icon $icon_path for $class $variant ", $self->icon_html;
62    
63  =for later  =for later
64    

Legend:
Removed from v.1128  
changed lines
  Added in v.1129

  ViewVC Help
Powered by ViewVC 1.1.26