From: b Date: Sat, 6 Jan 2024 13:07:56 +0000 (+0000) Subject: started work to support comment in viewer X-Git-Tag: v1.2.0~2 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=9803be43d60a1488d3436c3b0342dd7a18074f6d;p=ott%2Fbsta started work to support comment in viewer --- diff --git a/botm-common b/botm-common index 92789f8..6b4b21b 160000 --- a/botm-common +++ b/botm-common @@ -1 +1 @@ -Subproject commit 92789f87d558991f3b602fcc553ddc37cfe83b5c +Subproject commit 6b4b21b9139670faf83bb894ec378d49ecc6acdc diff --git a/bsta.css b/bsta.css index d5a3ce2..f03fb82 100644 --- a/bsta.css +++ b/bsta.css @@ -93,6 +93,17 @@ div#title margin: 0px; } +div.title +{ + text-align: center; + padding-top: 21px; + padding-bottom: 21px; + padding-left: 0px; + padding-right: 0px; + border: 0px; + margin: 0px; +} + h1#titletext { margin: 0px; @@ -100,6 +111,13 @@ h1#titletext padding: 0px; } +h1.titletext +{ + margin: 0px; + border: 0px; + padding: 0px; +} + div#storypuzzle { text-align: left; @@ -193,6 +211,14 @@ div#undertext border: 0px; } +div.undertext +{ + text-align: left; + padding: 8px; + margin: 0px; + border: 0px; +} + div#chat { text-align: left; @@ -225,6 +251,39 @@ div.tq:hover border-color: #bb6622; } +div.comment +{ + text-align: left; + border: solid #0057af 4px; + background-color: #0057af; +} + +div.comment:hover +{ + border-color: #bb6622; + background-color: #bb6622; +} + +div.commentinfo +{ + color: #ffffff!important; + /* font-weight: bold; */ +} + +div.commenttext +{ + background-color: #ffffff; + color: #000000; +} + +div.space +{ + background-color: #46a3ff; + height: 27px; + margin-top: 27px; + margin-bottom: 27px; +} + div#command { text-align: left; diff --git a/bsta_lib.1.pm b/bsta_lib.1.pm index 575ec16..2f1581d 100644 --- a/bsta_lib.1.pm +++ b/bsta_lib.1.pm @@ -123,6 +123,7 @@ use constant TEXT_MODE => { 'normal' => 0, 'bb' => 1, 'info' => 2, + 'words' => 3 }; use constant CHAT_STATE => { 'disconnected' => 0, @@ -846,6 +847,7 @@ sub print_html_data { print $fh html_encode_line("\n".$data->{'content'}); } +# TODO: previous page preload? sub print_viewer_page { ( my $file, @@ -853,7 +855,8 @@ sub print_viewer_page { my $state, my $settings, my $frame_data, - my $next_frame_data + my $next_frame_data, + my $words_data, ) = @_; my $fh; @@ -866,6 +869,7 @@ sub print_viewer_page { my $text_mode = int($context->{'text_mode'}); my $timer_unlocked = int($context->{'timer_unlocked'}); my $timer = int($context->{'timer'}); + my $words_page = int($context->{'words_page'}); # my $prev_frame = $frame - 1; my $next_frame = $frame + 1; @@ -910,6 +914,9 @@ sub print_viewer_page { $timer_s = 'EE'; } + my $words_posts = int($words_data->{'posts'}); + my $words_link_text = 'Words'.(($words_posts > 0) ? "[$words_posts]" : ''); + my $prev_available = (($frame > 0) && $access); my $next_available = ($launch || $password_ok || ($next_frame <= $last_frame)); my $prefetch_next = ( @@ -1000,6 +1007,12 @@ sub print_viewer_page { 'b' => TEXT_MODE->{'info'} }} ); + my $words_url = merge_url ( + $viewer_url, + {'query'=>{ + 'b' => TEXT_MODE->{'words'} + }} + ); my $frame_file; my $frame_url; my $frame_next_url; @@ -1050,6 +1063,7 @@ sub print_viewer_page { $password_query = url_query_encode({'p', $settings->{'password'}}); $goto_url = merge_url($goto_url , {'query' => $password_query, 'append_query' => 1}); $info_url = merge_url($info_url , {'query' => $password_query, 'append_query' => 1}); + $words_url = merge_url($words_url , {'query' => $password_query, 'append_query' => 1}); $bbcode_url = merge_url($bbcode_url , {'query' => $password_query, 'append_query' => 1}); $viewer_url = merge_url($viewer_url , {'query' => $password_query, 'append_query' => 1}); $viewer_0_url = merge_url($viewer_0_url , {'query' => $password_query, 'append_query' => 1}); @@ -1066,6 +1080,7 @@ sub print_viewer_page { my $_base_url = html_entity_encode_dec($base_url , 1); my $_goto_url = html_entity_encode_dec($goto_url , 1); my $_info_url = html_entity_encode_dec($info_url , 1); + my $_words_url = html_entity_encode_dec($words_url , 1); my $_bbcode_url = html_entity_encode_dec($bbcode_url , 1); my $_timer_url = html_entity_encode_dec($timer_url , 1); my $_viewer_full_url = html_entity_encode_dec($viewer_full_url, 1); @@ -1210,7 +1225,10 @@ sub print_viewer_page { } print $fh 'GOTO'."\n"; print $fh ' '."\n "; - if ($text_mode != TEXT_MODE->{'normal'}) { + if ($text_mode == TEXT_MODE->{'normal'}) { + print $fh ''.$words_link_text.' | '; + } + else { print $fh 'Without | '; } print $fh 'Info | '; @@ -1220,6 +1238,10 @@ sub print_viewer_page { print $fh " \n"; print $fh " \n"; + if ($text_mode == TEXT_MODE->{'words'}) { + # TODO: HERE PRINT COMMENTS + } + print_html_body_end($fh, $ong_state == STATE->{'inactive'}); print_html_end($fh); @@ -1255,6 +1277,13 @@ sub write_index { my %frame_data = read_data_file(join_path(PATH_SEPARATOR(), DATA_PATH(), 0)); my %next_frame_data= read_data_file(join_path(PATH_SEPARATOR(), DATA_PATH(), 1)); my %default = read_data_file(DATA_DEFAULT_PATH()); + my %words_data = read_data_file( + join_path(PATH_SEPARATOR(), DATA_WORDS_PATH(), 0), + '', # encoding + 0, # no header + 1, # header only + 1, # as list + ); %frame_data = merge_settings(\%default, \%frame_data); %next_frame_data= merge_settings(\%default, \%next_frame_data); @@ -1262,19 +1291,22 @@ sub write_index { $r = print_viewer_page( $fh, { - 'launch' => 0, - 'frame' => 0, - 'access' => 1, - 'password_ok' => 0, + 'launch' => 0, + 'frame' => 0, + 'access' => 1, + 'password_ok' => 0, 'timer_unlocked' => 3, # not relevant - 'timer' => 0, # not relevant - 'static' => 1, - 'show_command' => 1 + 'timer' => 0, # not relevant + 'static' => 1, + 'show_command' => 1, + 'text_mode' => TEXT_MODE->{'normal'}, + 'words_page' => 0 # not relevant }, $state, $settings, \%frame_data, - \%next_frame_data + \%next_frame_data, + \%words_data ); } # no conditions met, pretend a normal Apache2 index @@ -1341,19 +1373,22 @@ sub write_index { $r = print_viewer_page( $fh, { - 'launch' => 1, - 'frame' => 0, - 'access' => 1, - 'password_ok' => 0, + 'launch' => 1, + 'frame' => 0, + 'access' => 1, + 'password_ok' => 0, 'timer_unlocked' => 3, - 'timer' => 0, - 'static' => 1, - 'show_command' => 1, + 'timer' => 0, + 'static' => 1, + 'show_command' => 1, + 'text_mode' => TEXT_MODE->{'normal'}, + 'words_page' => 0 # not relevant }, $state, $settings, \%frame_data, - \%next_frame_data + \%next_frame_data, + {'posts' => 0} # words_data ); return $r; } diff --git a/makefile b/makefile index 36db1a7..3f30f89 100644 --- a/makefile +++ b/makefile @@ -33,12 +33,13 @@ PERL =/usr/bin/perl RM =/usr/bin/rm SUDO =/usr/bin/sudo -BIN_PATH = /botm/bin/test-bsta -DATA_PATH = /botm/data/test-bsta -LIB_PATH = /botm/lib/test-bsta -LOG_PATH = /botm/log/test-bsta -TMP_PATH = /botm/tmp/test-bsta -WWW_PATH = /botm/www/1190/bstatest +BIN_PATH = /botm/bin/test-bsta +DATA_PATH = /botm/data/test-bsta +DATA_WORDS_PATH = /botm/data/test-bsta/words +LIB_PATH = /botm/lib/test-bsta +LOG_PATH = /botm/log/test-bsta +TMP_PATH = /botm/tmp/test-bsta +WWW_PATH = /botm/www/1190/bstatest CONF = /botm/etc/www/conf/1190/test-bsta.conf CRON = /etc/cron.d/test-bsta @@ -87,6 +88,7 @@ viewer.pl DIR=\ $(BIN_PATH)\ $(DATA_PATH)\ +$(DATA_WORDS_PATH)\ $(LIB_PATH)\ $(LOG_PATH)\ $(TMP_PATH)\ @@ -94,6 +96,7 @@ $(WWW_PATH) HIDDEN_DIR=\ $(DATA_PATH)\ +$(DATA_WORDS_PATH)\ $(TMP_PATH) SETUID=\ diff --git a/makefile.1.mak b/makefile.1.mak index e4d82af..2609804 100644 --- a/makefile.1.mak +++ b/makefile.1.mak @@ -33,12 +33,13 @@ PERL = perl ###MAKE_RM: RM = rm ###MAKE_SUDO: SUDO = sudo -###MAKE_BIN_PATH: BIN_PATH = /botm/bin/bsta -###MAKE_DATA_PATH: DATA_PATH = /botm/data/bsta -###MAKE_LIB_PATH: LIB_PATH = /botm/lib/bsta -###MAKE_LOG_PATH: LOG_PATH = /botm/log/bsta -###MAKE_TMP_PATH: TMP_PATH = /botm/tmp/bsta -###MAKE_WWW_PATH: WWW_PATH = /botm/www/1190/bsta +###MAKE_BIN_PATH: BIN_PATH = /botm/bin/bsta +###MAKE_DATA_PATH: DATA_PATH = /botm/data/bsta +###MAKE_DATA_WORDS_PATH: DATA_WORDS_PATH = /botm/data/bsta/words +###MAKE_LIB_PATH: LIB_PATH = /botm/lib/bsta +###MAKE_LOG_PATH: LOG_PATH = /botm/log/bsta +###MAKE_TMP_PATH: TMP_PATH = /botm/tmp/bsta +###MAKE_WWW_PATH: WWW_PATH = /botm/www/1190/bsta ###MAKE_CONF: CONF = /botm/etc/www/conf/1190/bsta.conf ###MAKE_CRON: CRON = /etc/cron.d/bsta @@ -87,6 +88,7 @@ viewer.pl DIR=\ $(BIN_PATH)\ $(DATA_PATH)\ +$(DATA_WORDS_PATH)\ $(LIB_PATH)\ $(LOG_PATH)\ $(TMP_PATH)\ @@ -94,6 +96,7 @@ $(WWW_PATH) HIDDEN_DIR=\ $(DATA_PATH)\ +$(DATA_WORDS_PATH)\ $(TMP_PATH) SETUID=\ diff --git a/settings.txt b/settings.txt index 1464378..abd46c1 100644 --- a/settings.txt +++ b/settings.txt @@ -63,6 +63,7 @@ _data_noaccess_path = @_PATH( $data_path, noaccess ) _data_settings_path = @_PATH( $data_path, settings ) _data_state_path = @_PATH( $data_path, state ) _data_story_path = @_PATH( $data_path, story ) +_data_words_path = @_PATH( $data_path, words ) _log_path = @_PATH( $log_path, ) _log_ong_path = @_PATH( $log_path, ong.log) @@ -128,12 +129,13 @@ MAKE_CF = CF =$CF MAKE_CONF = CONF = $_conf_path MAKE_CRON = CRON = $_cron_path -MAKE_BIN_PATH = BIN_PATH = $bin_path -MAKE_DATA_PATH = DATA_PATH = $data_path -MAKE_LIB_PATH = LIB_PATH = $lib_path -MAKE_LOG_PATH = LOG_PATH = $log_path -MAKE_TMP_PATH = TMP_PATH = $tmp_path -MAKE_WWW_PATH = WWW_PATH = $www_path +MAKE_BIN_PATH = BIN_PATH = $bin_path +MAKE_DATA_PATH = DATA_PATH = $data_path +MAKE_DATA_WORDS_PATH = DATA_WORDS_PATH = $_data_words_path +MAKE_LIB_PATH = LIB_PATH = $lib_path +MAKE_LOG_PATH = LOG_PATH = $log_path +MAKE_TMP_PATH = TMP_PATH = $tmp_path +MAKE_WWW_PATH = WWW_PATH = $www_path PERL_LIB = @_PERL_USE_2(lib, @_PERL_STR($lib_path)) @@ -167,6 +169,7 @@ PERL_DATA_NOACCESS_PATH = @_PERL_CONSTANT_STR( DATA_NOACCESS_PATH, $_data_noacce PERL_DATA_SETTINGS_PATH = @_PERL_CONSTANT_STR( DATA_SETTINGS_PATH, $_data_settings_path) PERL_DATA_STATE_PATH = @_PERL_CONSTANT_STR( DATA_STATE_PATH , $_data_state_path ) PERL_DATA_STORY_PATH = @_PERL_CONSTANT_STR( DATA_STORY_PATH , $_data_story_path ) +PERL_DATA_WORDS_PATH = @_PERL_CONSTANT_STR( DATA_WORDS_PATH , $_data_words_path ) PERL_LOG_PATH = @_PERL_CONSTANT_STR( LOG_PATH, $_log_path) diff --git a/viewer.1.pl b/viewer.1.pl index 9c5364a..f58229d 100644 --- a/viewer.1.pl +++ b/viewer.1.pl @@ -50,6 +50,7 @@ use bsta_lib ( ###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings ###PERL_DATA_STATE_PATH: DATA_STATE_PATH = /botm/data/bsta/state ###PERL_DATA_STORY_PATH: DATA_STORY_PATH = /botm/data/bsta/story +###PERL_DATA_WORDS_PATH: DATA_WORDS_PATH = /botm/data/bsta/words/ binmode STDIN, ':encoding(UTF-8)'; binmode STDOUT, ':encoding(UTF-8)'; @@ -68,6 +69,7 @@ my %settings; my %state; my %new_state; my %goto_list; +my %words_data; my $method; my $frame; @@ -83,6 +85,8 @@ my $state_file; my $show_command; my $ongtime; my $text_mode; +my $words_page; +my $words_data_path; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; ###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin; @@ -274,9 +278,19 @@ else { } $text_mode = int($cgi{'b'}); -if($text_mode > 2) { +if($text_mode > TEXT_MODE->{'words'}) { $text_mode = TEXT_MODE->{'normal'}; } +$words_page = int($cgi{'i'}); + +$words_data_path = join_path(PATH_SEPARATOR(), DATA_WORDS_PATH(), $frame); +%words_data = read_data_file( + $words_data_path, # file + '', # encoding + 0, # no header + ($text_mode != TEXT_MODE->{'words'}), # header only + 1, # as list +); print "Content-type: text/html\n"; if(!$access) { @@ -299,9 +313,11 @@ print_viewer_page ( 'static' => 0, 'show_command' => $show_command, 'text_mode' => $text_mode, + 'words_page' => $words_page }, \%state, \%settings, \%frame_data, - \%next_frame_data + \%next_frame_data, + \%words_data, );