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; |
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 ) . |
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; |
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">|; |