From: b Date: Tue, 26 Sep 2023 22:17:31 +0000 (+0000) Subject: Continue viewer rework. X-Git-Tag: v1.1.0~42 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=61355592419a5c8d2af8cc1868ec33bcbeb6725a;p=ott%2Fbsta Continue viewer rework. --- diff --git a/bsta_lib.1.pm b/bsta_lib.1.pm index a6b53bc..aed142b 100644 --- a/bsta_lib.1.pm +++ b/bsta_lib.1.pm @@ -26,6 +26,33 @@ use utf8; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); +###PERL_EXPORT_VERSION: our $VERSION = 'x.x.x'; +our @ISA = qw(Exporter); +our @EXPORT = (); +our @EXPORT_OK = ( + 'STATE', + 'entityencode', # TO REMOVE + 'failpage', 'fail_method', 'fail_content_type', + 'gethttpheader', 'getcgi', # TO REMOVE + 'urldecode', # TO REMOVE + 'readdatafile', 'writedatafile', 'printdatafile', + 'printdatafileht', # TO REMOVE ??? + 'urlencode', # TO REMOVE + 'linehtml', + 'bb2ht', 'bb2bb' +); + +###PERL_LIB: use lib /botm/lib/bsta +use botm_common ( + 'html_entity_encode_dec' +); + +###PERL_CGI_GOTO_PATH: CGI_GOTO_PATH = /bsta/g +###PERL_CGI_LOGO_PATH: CGI_LOGO_PATH = /bsta/botmlogo.png + +###PERL_WEBSITE: WEBSITE = 1190.bicyclesonthemoon.info + + # TO REMOVE use constant entitycode => { 'amp' => '&', @@ -351,26 +378,24 @@ use constant tagsht => { '/?' => '[/unknown!]', }; -###PERL_EXPORT_VERSION: our $VERSION = 'x.x.x'; -our @ISA = qw(Exporter); -our @EXPORT = (); -our @EXPORT_OK = ( - 'STATE', - 'entityencode' # TO REMOVE - 'failpage', 'fail_method', 'fail_content_type', - 'gethttpheader', 'getcgi', # TO REMOVE - 'urldecode', # TO REMOVE - 'readdatafile', 'writedatafile', 'printdatafile', - 'printdatafileht', # TO REMOVE ??? - 'urlencode', # TO REMOVE - 'linehtml', - 'bb2ht', 'bb2bb' -); - -###PERL_LIB: use lib /botm/lib/bsta -use botm_common ( - 'html_entity_encode_dec' -); +use constant HTML_START => + ''."\n". + ''."\n"; +use constant HTML_END => + ''."\n"; +use constant HTML_HEAD_START => + ''."\n". + ''."\n"; +use constant HTML_HEAD_END => + ''."\n"; +use constant HTML_BODY_START => + ''."\n". + ''."\n". + '
'."\n"; +use constant HTML_BODY_END => + '
'."\n". + ''.html_entity_encode_dec(WEBSITE).''."\n". + ''."\n"; # Function to return an error page @@ -419,7 +444,7 @@ sub fail_method { sub fail_content_type { - (my $content_type, $method) = @_ + (my $content_type, my $method) = @_; return failpage( "Status: 415 Unsupported Media Type\n", diff --git a/makefile b/makefile index 5a25a9e..d34a91e 100644 --- a/makefile +++ b/makefile @@ -135,6 +135,7 @@ $(EXEC)\ $(PERL_WRAP_EXEC) LIB=\ +botm-common/botm_common.pm\ bsta_lib.pm WWW=\ diff --git a/makefile.1.mak b/makefile.1.mak index 5884acc..ead7f84 100644 --- a/makefile.1.mak +++ b/makefile.1.mak @@ -135,7 +135,7 @@ $(EXEC)\ $(PERL_WRAP_EXEC) LIB=\ -botm_common/botm_common.pm +botm-common/botm_common.pm\ bsta_lib.pm WWW=\ diff --git a/viewer.1.pl b/viewer.1.pl index 527bab8..f0ad73b 100644 --- a/viewer.1.pl +++ b/viewer.1.pl @@ -27,16 +27,20 @@ use Encode ('encode', 'decode'); ###PERL_LIB: use lib /botm/lib/bsta use botm_common ( - 'read-header_env', - 'read_data_file', 'write_data_file' + 'read_header_env', + 'read_data_file', 'write_data_file', + 'url_query_decode', + 'join_path' ); use bsta_lib ( 'STATE', 'fail_method', 'fail_content_type', 'entityencode', - 'printdatafileht' + 'printdatafileht', 'urlencode', - 'bb2ht', 'bb2bb', 'linehtml' + 'bb2ht', 'bb2bb', 'linehtml', + + 'readdatafile', 'writedatafile' ); use File::Copy; @@ -144,7 +148,7 @@ elsif ($ENV{'PATH_INFO'} =~ /^\/(.+)$/) { else { $frame = 0; } -$frame_data_path = join_path('/', DATA_PATH, $frame); +$framedata_path = join_path('/', DATA_PATH, $frame); if ($cgi{'p'} =~ /^(.+)$/) { $password = $1; @@ -156,7 +160,7 @@ else { %settings = read_data_file(DATA_SETTINGS_PATH); %default = read_data_file(DATA_DEFAULT_PATH); -%framedata= read_data_file($frame_data_path); +%framedata= read_data_file($framedata_path); if ($password eq $settings{'password'}) { $passwordOK = 1; } @@ -171,8 +175,8 @@ if (open ($statefile, "+<:encoding(UTF-8)", DATA_STATE_PATH)) { if ($frame < 0) { $frame = int($state{'last'}) + $frame +1; - $frame_data_path = join_path('/', DATA_PATH, $frame); - %framedata = read_data_file($frame_data_path); + $framedata_path = join_path('/', DATA_PATH, $frame); + %framedata = read_data_file($framedata_path); } if (