/[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 816 by dpavlin, Thu Dec 11 21:36:04 2008 UTC revision 835 by dpavlin, Sun Dec 14 14:13:35 2008 UTC
# Line 246  sub page { Line 246  sub page {
246          if ( ! $body ) {          if ( ! $body ) {
247                  my $run = $a->{run} || 'as_markup';                  my $run = $a->{run} || 'as_markup';
248                  warn "# no body, invoke $self->$run on ", ref($self);                  warn "# no body, invoke $self->$run on ", ref($self);
249                  eval {                  $body = $self->$run;
                         $body = $self->$run;  
                 };  
                 $body = $self->error( $@, '' ) if $@;  
250          }          }
251          if ( $self->content_type !~ m{html} ) {          if ( $self->content_type !~ m{html} ) {
252                  warn "# return only $self body ", $self->content_type;                  warn "# return only $self body ", $self->content_type;
# Line 386  sub error { Line 383  sub error {
383          }          }
384    
385          warn "ERROR: $error\n";          warn "ERROR: $error\n";
386            $self->add_icon('error');
387          return          return
388                  qq|<pre class="frey-error$fatal">|                  qq|<pre class="frey-error$fatal">|
389                  . $self->html_links( $error ) .                  . $self->html_links( $error ) .
# Line 466  sub DEMOLISH { Line 464  sub DEMOLISH {
464    
465  sub icon_path {  sub icon_path {
466          my ($self,$class,$variant) = @_;          my ($self,$class,$variant) = @_;
 #       $class ||= $self->title;  
467    
468          sub icon_exists {          sub icon_exists {
469                  my $class = shift;                  my $class = shift;
# Line 478  sub icon_path { Line 475  sub icon_path {
475          }          }
476    
477          my $path = icon_exists( $class );          my $path = icon_exists( $class );
478            if ( ! $path ) {
479          while ( $class =~ s{::[^:]+$}{} && ! $path ) {                  my $super_class = $class;
480                  $path = icon_exists( $class ) unless $class eq 'Frey'; # don't default on Frey icon                  while ( $super_class =~ s{::[^:]+$}{} && ! $path ) {
481                            $path = icon_exists( $super_class ) unless $super_class eq 'Frey'; # don't default on Frey icon
482                    }
483          }          }
484    
485          if ( -e $path ) {          if ( ! $path ) {
486                  warn "# $class from $self icon_path $path" if $self->debug;                  $self->TODO( "add icon for $class" . ( $variant ? " variant $variant" : '' ) );
                 return $path;  
         } else {  
                 $self->TODO( "add $path icon for $class $variant" );  
487                  return undef;                  return undef;
488          }          }
489    
490            warn "# $class from $self icon_path $path" if $self->debug;
491            return $path;
492  }  }
493    
494  sub add_icon {  sub add_icon {
495          my ($self,$variant) = @_;          my ($self,$variant) = @_;
496    
497          my $class = ref($self);          my $class = $self->class if $self->can('class');
498          $class = $self->class if $self->can('class');          #$class ||= $self->title;
499            $class ||= ref($self);
500          my $icon_path = $self->icon_path( $class, $variant ) || return;          my $icon_path = $self->icon_path( $class, $variant ) || return;
501    
502          $icon_html .= qq|<link rel="icon" type="image/png" href="/$icon_path">|;          $icon_html .= qq|<link rel="icon" type="image/png" href="/$icon_path">|;

Legend:
Removed from v.816  
changed lines
  Added in v.835

  ViewVC Help
Powered by ViewVC 1.1.26