/[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 972 by dpavlin, Fri Jan 9 19:33:26 2009 UTC
# Line 4  use Moose; Line 4  use Moose;
4  extends 'Frey';  extends 'Frey';
5  with 'Frey::Web';  with 'Frey::Web';
6  with 'Frey::Web::CombineImages';  with 'Frey::Web::CombineImages';
7    with 'Frey::File';
8    
9  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
10    
# Line 27  sub as_markup { Line 28  sub as_markup {
28          $self->title( 'icons - ' . $self->path );          $self->title( 'icons - ' . $self->path );
29    
30          my $extension = '\.(?:png)$';          my $extension = '\.(?:png)$';
31            my @icons = $self->dir_extension( $self->path, qr{$extension} );
32    
33          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 );  
34    
35          my $width = 0;          my $width = 0;
36          foreach ( @icons ) {          foreach ( @icons ) {
# Line 62  sub as_markup { Line 60  sub as_markup {
60    
61          foreach my $icon ( @icons ) {          foreach my $icon ( @icons ) {
62                  my $name = $icon;                  my $name = $icon;
63                  $name =~ s{$extension}{};                  $name =~ s{^[\w/]*/([^/]+)$extension}{$1};
64    
65                  if ( ! $base ) {                  if ( ! $base ) {
66                          $base = $name;                          $base = $name;
# Line 91  sub as_markup { Line 89  sub as_markup {
89  #               $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|;
90  #               $html .= qq|<b>$name</b>$desc<br/>\n|;  #               $html .= qq|<b>$name</b>$desc<br/>\n|;
91    
92                  my $path = $self->path . '/' . $icon;                  my $path = $icon;
93                    $path = $self->path . '/' . $icon unless $icon =~ m{[\w/]+/[^/]+$};
94    
95                  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 );
96                  $html .= ''                  $html .= ''

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

  ViewVC Help
Powered by ViewVC 1.1.26