16 |
documentation => 'Show usage on top of list', |
documentation => 'Show usage on top of list', |
17 |
); |
); |
18 |
|
|
19 |
|
our $usage; |
20 |
|
|
21 |
sub as_markup { |
sub as_markup { |
22 |
my $self = shift; |
my $self = shift; |
23 |
my $row; |
my $row; |
24 |
my @icons; |
my @icons; |
25 |
|
|
26 |
my $usage = $self->session_dump( $self->usage ); |
$usage ||= $self->session_dump( $self->usage ); |
27 |
#warn "# usage ",dump( $usage ); |
#warn "# usage ",dump( $usage ); |
28 |
foreach my $class ( $self->classes ) { |
foreach my $class ( $self->classes ) { |
29 |
|
|
30 |
my $icon = ''; |
my $icon = ''; |
31 |
if ( ! $self->can('icon_path') ) { |
if ( ! $self->can('icon_path') ) { |
32 |
warn "FIXME: re-apply Frey::Web on $self"; |
$self->TODO( "re-apply Frey::Web on $self" ); |
33 |
Frey::Web->meta->apply( $self ); |
Frey::Web->meta->apply( $self ); |
34 |
} |
} |
35 |
$icon = $self->icon_path( $class ); |
$icon = $self->icon_path( $class ); |
36 |
if ($icon) { |
if ($icon) { |
37 |
push @icons, $icon; |
push @icons, $icon; |
38 |
$icon = qq|<!-- icon:$icon -->|; |
$icon = qq|<!-- icon:$icon -->|; |
39 |
|
} else { |
40 |
|
$icon = ''; |
41 |
} |
} |
42 |
|
|
43 |
my $html |
my $html |
54 |
} |
} |
55 |
|
|
56 |
my @run = map { |
my @run = map { |
57 |
|
my $invoke = $_; |
58 |
s{^as_}{}; |
s{^as_}{}; |
59 |
qq|<a target="$class" href="/$class/as_$_" title="$class->as_$_">$_</a>|; |
s{_as_\w+}{}; |
60 |
|
qq|<a target="$class" href="/$class/$invoke" title="$class->$invoke">$_</a>|; |
61 |
} $self->class_runnable( $class ); |
} $self->class_runnable( $class ); |
62 |
push @run, qq|<a target="$class" href="/Frey-ObjectBrowser?class=$class">collection</a>| if $class->can('collection_table'); |
push @run, qq|<a target="$class" href="/Frey-ObjectBrowser?class=$class">collection</a>| if $class->can('collection_table'); |
63 |
|
|
78 |
|
|
79 |
my $icons_html = $self->combine_images( @icons ); |
my $icons_html = $self->combine_images( @icons ); |
80 |
sub icon { |
sub icon { |
81 |
my $path = shift; |
my ($icons_html,$path) = @_; |
|
warn "# icon $path"; |
|
82 |
$icons_html->{ $path } || die "can't find $path in ",dump($icons_html); |
$icons_html->{ $path } || die "can't find $path in ",dump($icons_html); |
83 |
}; |
}; |
84 |
|
|
85 |
|
$self->title('Frey'); |
86 |
|
|
87 |
return |
return |
88 |
qq|<table>| . join("\n", |
qq|<table>| . join("\n", |
89 |
map { |
map { |
90 |
my $html = $row->{$_}; |
my $html = $row->{$_}; |
91 |
$html =~ s{<!-- icon:(\S+) -->}{icon($1)}gse; |
$html =~ s{<!-- icon:(\S+) -->}{icon($icons_html,$1)}gse; |
92 |
$html; |
$html; |
93 |
} |
} |
94 |
sort { |
sort { |