sub export {
my $self = shift;
+ my $dir = $self->app->home->rel_dir('public');
+
if ( my $import = $self->param('import') ) {
if ( $import =~ m{/filter\.(.+?)\..+} ) {
my $name = $1;
my @vals = map { chomp; $_ }
- read_file $self->app->home->rel_dir('public') . "/export/$import", binmode => ':utf8';
+ read_file "$dir/export/$import", binmode => ':utf8';
$self->_remove_filter( $name );
$self->_filter_on_data( $name, @vals );
$self->session( 'offset' => 0 );
}
}
+ if ( my $remove = $self->param('remove') ) {
+ my $path = "$dir/export/$remove";
+ unlink $path if -e $path;
+ $path .= '.png';
+ unlink $path if -e $path;
+ }
+
my @files = grep { ! /\.png$/ } glob( $self->_export_path . '*' );
my $mtime = { map { $_ => (stat($_))[9] } @files };
@files = sort { $mtime->{$b} <=> $mtime->{$a} } @files;
% foreach my $e ( @$export ) {
% my $path = $e; $path =~ s{^.+/public/export/}{};
<li>
+<label>
<tt>
<a target="<%= $path %>" href="/export/<%= $path %>"><%= $path %></a>
</tt>
<%= -s $e %> bytes
-% if ( -e $e . '.png' ) {
-<br><img src="/export/<%= $path %>.png">
-% } elsif ( $path =~ m/filter\./ ) {
+<a style="color:red; float: right" href="<%= url_for( action => 'export' )->query( 'remove' => $path ) %>">remove</a>
+% if ( $path =~ m/filter\./ ) {
<a href="?import=<%= $path %>">import</a>
% }
+</label>
+% if ( -e $e . '.png' ) {
+<img src="/export/<%= $path %>.png">
+% }
% }
</ul>