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

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

revision 608 by dpavlin, Fri Nov 28 23:28:12 2008 UTC revision 1133 by dpavlin, Tue Jun 30 15:10:55 2009 UTC
# Line 2  package Frey::IconBrowser; Line 2  package Frey::IconBrowser;
2  use Moose;  use Moose;
3    
4  extends 'Frey';  extends 'Frey';
5  with 'Frey::Web';  with 'Frey::Web', 'Frey::Web::CombineImages', 'Frey::File';
 with 'Frey::Web::CombineImages';  
6    
7  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
8    
# Line 27  sub as_markup { Line 26  sub as_markup {
26          $self->title( 'icons - ' . $self->path );          $self->title( 'icons - ' . $self->path );
27    
28          my $extension = '\.(?:png)$';          my $extension = '\.(?:png)$';
29            my @icons = $self->dir_extension( $self->path, qr{$extension} );
30    
31          opendir(my $dir, $self->path) || die "can't opendir ", $self->path, ": $!";          my ( $combined_path, $styles ) = $self->combine_images( @icons );
         my @icons = sort grep { m/$extension/ } readdir($dir);  
         closedir $dir;  
   
         my ( $combined_path, $styles ) = $self->combine_images( map { $self->path . '/' . $_ } @icons );  
32    
33          my $width = 0;          my $width = 0;
34          foreach ( @icons ) {          foreach ( @icons ) {
# Line 62  sub as_markup { Line 58  sub as_markup {
58    
59          foreach my $icon ( @icons ) {          foreach my $icon ( @icons ) {
60                  my $name = $icon;                  my $name = $icon;
61                  $name =~ s{$extension}{};                  $name =~ s{^[\w/]*/([^/]+)$extension}{$1};
62    
63                  if ( ! $base ) {                  if ( ! $base ) {
64                          $base = $name;                          $base = $name;
# Line 91  sub as_markup { Line 87  sub as_markup {
87  #               $html .= qq|<img src="/| . $self->path . qq|/$icon" alt="$icon"> <b>$name</b>$desc<br/>\n|;  #               $html .= qq|<img src="/| . $self->path . qq|/$icon" alt="$icon"> <b>$name</b>$desc<br/>\n|;
88  #               $html .= qq|<b>$name</b>$desc<br/>\n|;  #               $html .= qq|<b>$name</b>$desc<br/>\n|;
89    
90                  my $path = $self->path . '/' . $icon;                  my $path = $icon;
91                    $path = $self->path . '/' . $icon unless $icon =~ m{[\w/]+/[^/]+$};
92    
93                  my $pic = $styles->{$path} || die "can't find pic for $path in ",dump( $styles );                  my $pic = $styles->{$path} || die "can't find pic for $path in ",dump( $styles );
94                  $html .= ''                  $html .= ''
# Line 107  sub as_markup { Line 104  sub as_markup {
104          return $html;          return $html;
105  }  }
106    
107    __PACKAGE__->meta->make_immutable;
108    no Moose;
109    
110  1;  1;

Legend:
Removed from v.608  
changed lines
  Added in v.1133

  ViewVC Help
Powered by ViewVC 1.1.26