// Book title and the URL used for the book title link
br.bookTitle= '%s';
-br.bookUrl = 'http://openlibrary.org';
+br.bookUrl = '%s';
// Override the path used to find UI images
br.imagesBaseURL = '/BookReader/images/';
push @files, [ $url, $basename, $stat[7], $mime_type, HTTP::Date::time2str($stat[9]) ];
}
+ warn "# page_files = ",dump( @page_files );
+
my $dir = Plack::Util::encode_html( $env->{PATH_INFO} );
my $page = 'empty';
my $pages;
my $pages_path = "cache/$dir_url/bookreader.json";
- if ( 0 && -e $pages_path ) {
+ if ( -e $pages_path ) {
$pages = decode_json read_file $pages_path;
} else {
$pages = [
warn "# created $pages_path ", -s $pages_path, " bytes\n";
}
warn "# pages = ",dump($pages);
- $page = sprintf $reader_page, $dir, encode_json( $pages ), $dir; # FIXME: title
+ $page = sprintf $reader_page, $dir, encode_json( $pages ), $dir, $dir;
} else {
sprintf $dir_file, map Plack::Util::encode_html($_), @$f;
} @files;
- $page = sprintf $dir_page, $dir, $dir, $files;
+ $page = sprintf $dir_page, $dir, $dir, $files,
+ @page_files ? '<form><input type=submit name=bookreader value="Read"></form>' : '';
}