'print_html_start', 'print_html_end',
'print_html_head_start', 'print_html_head_end',
'print_html_body_start', 'print_html_body_end',
- 'print_viewer_page',
+ 'print_viewer_page', 'print_goto',
'write_index', 'write_static_viewer_page', 'write_static_goto',
'ong',
'eval_bb', 'bb_to_bbcode', 'bb_to_html'
###PERL_CGI_FRAME_PATH: CGI_FRAME_PATH = /bsta/f
###PERL_CGI_GOTO_PATH: CGI_GOTO_PATH = /bsta/g
###PERL_CGI_INFO_PATH: CGI_INFO_PATH = /bsta/i
+###PERL_CGI_LIST_PATH: CGI_LIST_PATH = /bsta/goto.htm
###PERL_CGI_LOGO_PATH: CGI_LOGO_PATH = /bsta/botmlogo.png
###PERL_CGI_TIMER_PATH: CGI_TIMER_PATH = /bsta/timer.js
###PERL_CGI_VIEWER_PATH: CGI_VIEWER_PATH = /bsta/v
###PERL_DATA_DEFAULT_PATH: DATA_DEFAULT_PATH = /botm/data/bsta/default
###PERL_DATA_LIST_PATH: DATA_LIST_PATH = /botm/data/bsta/list
###PERL_DATA_NOACCESS_PATH: DATA_NOACCESS_PATH = /botm/data/bsta/noaccess
+###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
###PERL_DATA_STATE_PATH: DATA_STATE_PATH = /botm/data/bsta/state
###PERL_DATA_WORDS_PATH: DATA_WORDS_PATH = /botm/data/bsta/words/
###PERL_WWW_PATH: WWW_PATH = /botm/www/
+###PERL_WWW_GOTO_PATH: WWW_GOTO_PATH = /botm/www/1190/bsta/goto.htm
###PERL_WWW_INDEX_PATH: WWW_INDEX_PATH = /botm/www/1190/bsta/index.htm
###PERL_SCHEME: SCHEME = http
print $fh html_encode_line("\n".$data->{'content'});
}
+sub print_goto {
+ (
+ my $file,
+ my $state,
+ my $settings,
+ my $goto_list,
+ my $password_ok,
+ ) = @_;
+
+ my $fh;
+ my $last_frame;
+ my $ong_state;
+ my $password_query;
+
+ $last_frame = int($state->{'last'});
+ $ong_state = int($state->{'state'});
+ $password_query = url_query_encode({'p', $settings->{'password'}});
+
+ my $_title = html_entity_encode_dec($settings->{'story'}, 1);
+ my $_website_name = html_entity_encode_dec(WEBSITE_NAME() , 1);
+ my $_base_url = html_entity_encode_dec(CGI_PATH() , 1);
+
+ if (ref($file)) {
+ $fh=$file;
+ unless (seek($fh, 0, 0)) {
+ #don't actually fail here
+ }
+ }
+ else {
+ unless (open_encoded($fh, ">:encoding(UTF-8)", $file)) {
+ return 0;
+ }
+ }
+
+ print_html_start($fh);
+ print_html_head_start($fh);
+
+ print $fh ' <title>GOTO • '.$_title.' • '.$_website_name.'</title>'."\n";
+
+ print_html_head_end($fh);
+ print_html_body_start($fh);
+
+ print $fh ' <div id="inst" class="ins">'."\n";
+
+ print $fh ' <div id="title">'."\n";
+ print $fh ' <h1 id="titletext">'.$_title.'</h1>'."\n";
+ print $fh ' </div>'."\n";
+
+ print $fh ' </div>'."\n";
+ print $fh ' <div id="insb" class="ins">'."\n";
+
+ print $fh ' <div id="chat">'."\n";
+
+ for (my $frame = 0; ; $frame += 1) {
+ unless (
+ $password_ok || (
+ ($frame <= $last_frame) &&
+ ($ong_state >= STATE->{'waiting'})
+ )
+ ) {
+ last;
+ }
+ my $title;
+ my $ongtime;
+ my @time_tab;
+ my $time_text;
+ my $timer_color;
+ my $frame_text;
+ my $viewer_url;
+
+ $ongtime = $goto_list->{'ongtime-'.$frame};
+ $title = $goto_list->{'title-' .$frame};
+ if (($ongtime eq '') && ($title eq '')) {
+ my $frame_data_path = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame);
+ my %frame_data = read_data_file($frame_data_path);
+ $ongtime = $frame_data{'ongtime'};
+ $title = $frame_data{'title'};
+ unless (keys %frame_data) {
+ last;
+ }
+ }
+
+ if ($ongtime ne '') {
+ @time_tab = gmtime($ongtime);
+ $time_text = sprintf(
+ '%02d.%02d.%02d %02d:%02d',
+ $time_tab[3],
+ $time_tab[4]+1,
+ $time_tab[5]%100,
+ $time_tab[2],
+ $time_tab[1]
+ );
+ }
+ else {
+ $time_text = (($frame <= $last_frame) && ($ong_state >= STATE->{'waiting'})) ?
+ 'EE.EE.EE EE:EE' : '--.--.-- --:--';
+ }
+ if ($title eq '') {
+ $title = '_';
+ }
+ $timer_color = (($frame > $last_frame) || ($ong_state < STATE->{'waiting'})) ?
+ 'cz' : (
+ (($frame == $last_frame) && ($ong_state < STATE->{'ready'})) ?
+ 'ni' : 'br'
+ );
+ $frame_text = sprintf('%03d',$frame);
+ $viewer_url = merge_url(
+ {'path' => CGI_VIEWER_PATH()},
+ {'path' => $frame}
+ ); # TODO: consider static here?
+ if ($password_ok) {
+ $viewer_url = merge_url($viewer_url, {'query' => $password_query, 'append_query' => 1, 'preserve_fragment' => 1});
+ }
+
+ my $_viewer_url = html_entity_encode_dec($viewer_url, 1);
+ my $_title = html_entity_encode_dec($title , 1);
+
+ print $fh ' <span class="'.$timer_color.'">'.$frame_text.'</span> '.$time_text.' <a href="'.$_viewer_url.'">'.$_title.'</a><br>'."\n";
+ }
+ print $fh ' </div>'."\n";
+
+ print $fh ' <div id="underlinks">'."\n";
+ print $fh ' <a href="'.$_base_url.'">BSTA</a>'."\n";
+ print $fh ' </div>'."\n";
+
+ print $fh ' </div>'."\n";
+
+ print_html_body_end($fh, $ong_state == STATE->{'inactive'});
+ print_html_end($fh);
+
+ unless (ref($file)) {
+ close ($fh);
+ }
+ else {
+ truncate ($fh , tell($fh));
+ }
+
+ return 1;
+}
+
sub print_viewer_page {
(
my $file,
);
}
}
+ if (_x_encoded('-f',WWW_GOTO_PATH())) {
+ $goto_url = CGI_LIST_PATH();
+ }
}
my $bbcode_url = ($text_mode == TEXT_MODE->{'bb'}) ?
merge_url(
}
sub write_static_goto {
+ (my $state_ref, my $settings_ref, my $goto_ref) = @_;
+ my %state;
+ my %settings;
+ my %goto_list;
+ %state = (ref ($state_ref)) ?
+ %$state_ref :
+ read_data_file(DATA_STATE_PATH());
+ %settings = (ref ($settings_ref)) ?
+ %$settings_ref :
+ read_data_file(DATA_SETTINGS_PATH());
+ %goto_list = (ref ($goto_ref)) ?
+ %$goto_ref :
+ read_data_file(DATA_SETTINGS_PATH());
+
+ return print_goto(
+ WWW_GOTO_PATH(),
+ \%state,
+ \%settings,
+ \%goto_list,
+ 0, # password OK
+ );
}
# ONG the frame + attachment & stuff. NOT update state file.
use botm_common (
'read_header_env',
'read_data_file',
- 'url_query_encode', 'url_query_decode',
- 'merge_url',
- 'join_path',
- 'html_entity_encode_dec'
+ 'url_query_decode',
+ '_x_encoded'
);
use bsta_lib (
'STATE',
'fail_method', 'fail_content_type',
+ 'redirect',
'get_password',
- 'print_html_start', 'print_html_end',
- 'print_html_head_start', 'print_html_head_end',
- 'print_html_body_start', 'print_html_body_end',
- 'write_index',
+ 'print_goto',
'merge_settings'
);
###PERL_PATH_SEPARATOR: PATH_SEPARATOR = /
###PERL_CGI_PATH: CGI_PATH = /bsta/
+###PERL_CGI_LIST_PATH: CGI_LIST_PATH = /bsta/goto.htm
###PERL_CGI_VIEWER_PATH: CGI_VIEWER_PATH = /bsta/v
###PERL_DATA_PATH: DATA_PATH = /botm/data/bsta/
###PERL_DATA_STATE_PATH: DATA_STATE_PATH = /botm/data/bsta/state
###PERL_DATA_LIST_PATH: DATA_LIST_PATH = /botm/data/bsta/list
+###PERL_WWW_GOTO_PATH: WWW_GOTO_PATH = /botm/www/1190/bsta/goto.htm
+
###PERL_WEBSITE_NAME: WEBSITE_NAME = Bicycles on the Moon
binmode STDIN, ':encoding(UTF-8)';
my $method;
my $password;
my $password_ok;
-my $password_query;
-my $frame;
-my $last_frame;
-my $ong_state;
-my $line;
+my $no_cgi;
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
}
}
+$no_cgi = (scalar (keys %cgi) == 0);
+
+if ($no_cgi) {
+ if (_x_encoded('-f', WWW_GOTO_PATH())) {
+ exit redirect($method, CGI_LIST_PATH());
+ }
+}
+
$password = get_password(\%cgi);
%settings = read_data_file(DATA_SETTINGS_PATH());
%state = read_data_file(DATA_STATE_PATH());
%goto_list = read_data_file(DATA_LIST_PATH());
-$last_frame = int($state{'last'});
-$ong_state = int($state{'state'});
-
$password_ok = ($password eq $settings{'password'});
-$password_query = url_query_encode({'p', $settings{'password'}});
print "Content-type: text/html; charset=UTF-8\n";
print "\n";
exit;
}
-my $_title = html_entity_encode_dec($settings{'story'}, 1);
-my $_website_name = html_entity_encode_dec(WEBSITE_NAME() , 1);
-my $_base_url = html_entity_encode_dec(CGI_PATH() , 1);
-
-print_html_start(\*STDOUT);
-print_html_head_start(\*STDOUT);
-
-print ' <title>GOTO • '.$_title.' • '.$_website_name.'</title>'."\n";
-
-print_html_head_end(\*STDOUT);
-print_html_body_start(\*STDOUT);
-
-print ' <div id="inst" class="ins">'."\n";
-
-print ' <div id="title">'."\n";
-print ' <h1 id="titletext">'.$_title.'</h1>'."\n";
-print ' </div>'."\n";
-
-print ' </div>'."\n";
-print ' <div id="insb" class="ins">'."\n";
-
-print ' <div id="chat">'."\n";
-for ($frame = 0; ; $frame += 1) {
- unless (
- $password_ok || (
- ($frame <= $last_frame) &&
- ($ong_state >= STATE->{'waiting'})
- )
- ) {
- last;
- }
- my $title;
- my $ongtime;
- my @time_tab;
- my $time_text;
- my $timer_color;
- my $frame_text;
- my $viewer_url;
-
- $ongtime = $goto_list{'ongtime-'.$frame};
- $title = $goto_list{'title-' .$frame};
- if (($ongtime eq '') && ($title eq '')) {
- my $frame_data_path = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame);
- my %frame_data = read_data_file($frame_data_path);
- $ongtime = $frame_data{'ongtime'};
- $title = $frame_data{'title'};
- unless (keys %frame_data) {
- last;
- }
- }
-
- if ($ongtime ne '') {
- @time_tab = gmtime($ongtime);
- $time_text = sprintf(
- '%02d.%02d.%02d %02d:%02d',
- $time_tab[3],
- $time_tab[4]+1,
- $time_tab[5]-100, # TODO: %100 ?
- $time_tab[2],
- $time_tab[1]
- );
- }
- else {
- $time_text = (($frame <= $last_frame) && ($ong_state >= STATE->{'waiting'})) ?
- 'EE.EE.EE EE:EE' : '--.--.-- --:--';
- }
- if ($title eq '') {
- $title = '_';
- }
- $timer_color = (($frame > $last_frame) || ($ong_state < STATE->{'waiting'})) ?
- 'cz' : (
- (($frame == $last_frame) && ($ong_state < STATE->{'ready'})) ?
- 'ni' : 'br'
- );
- $frame_text = sprintf('%03d',$frame);
- $viewer_url = merge_url(
- {'path' => CGI_VIEWER_PATH()},
- {'path' => $frame}
- );
- if ($password_ok) {
- $viewer_url = merge_url($viewer_url, {'query' => $password_query, 'append_query' => 1, 'preserve_fragment' => 1});
- }
-
- my $_viewer_url = html_entity_encode_dec($viewer_url, 1);
- my $_title = html_entity_encode_dec($title , 1);
-
- print ' <span class="'.$timer_color.'">'.$frame_text.'</span> '.$time_text.' <a href="'.$_viewer_url.'">'.$_title.'</a><br>'."\n";
-}
-print ' </div>'."\n";
-
-print ' <div id="underlinks">'."\n";
-print ' <a href="'.$_base_url.'">BSTA</a>'."\n";
-print ' </div>'."\n";
-
-print ' </div>'."\n";
-
-print_html_body_end(\*STDOUT, $ong_state == STATE->{'inactive'});
-print_html_end(\*STDOUT);
+print_goto(
+ \*STDOUT,
+ \%state,
+ \%settings,
+ \%goto_list,
+ $password_ok
+);
use bsta_lib (
'STATE',
'ong',
- 'write_static_viewer_page', 'write_index'
+ 'write_static_viewer_page', 'write_index', 'write_static_goto'
);
###PERL_PATH_SEPARATOR: PATH_SEPARATOR = /
###PERL_DATA_PATH: DATA_PATH = /botm/data/bsta/
###PERL_DATA_DEFAULT_PATH: DATA_DEFAULT_PATH = /botm/data/bsta/default
+###PERL_DATA_LIST_PATH: DATA_LIST_PATH = /botm/data/bsta/list
###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
###PERL_DATA_STATE_PATH: DATA_STATE_PATH = /botm/data/bsta/state
my %settings;
my %state;
-my %goto_list;
+my %new_state;
+# my %goto_list;
my %default;
my %frame_data;
+my %frame_1_data;
+my %frame_2_data;
+my %frame_3_data;
my $fh;
my $ongstate;
###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
unless (open_encoded($fh, "+<:encoding(UTF-8)", DATA_STATE_PATH())) {
- print "NO STATEFILE\n";
+ print "NO STATEFILE\n\n";
+ exit;
+}
+unless (flock($fh, 2)) {
+ print "NO STATELOCK\n\n";
+ close ($fh);
+ exit;
+}
+%state = read_data_file($fh);
+$ongstate = int($state{'state'});
+print 'state: '.$ongstate."\n";
+unless ($ongstate > STATE->{'inactive'}) {
+ print "INACTIVE\n\n";
+ close ($fh);
+ exit;
+}
+$next_ong = int($state{'nextong'});
+print 'ongtime: '.$next_ong."\n";
+
+unless ($ongtime >= $next_ong) {
+ print "WAIT\n\n";
+ close ($fh);
+ exit;
+}
+
+%settings = read_data_file(DATA_SETTINGS_PATH());
+$static_timer = int($settings{'ongtime'});
+$timer = int($settings{'dynamicongtime'});
+$last = int($settings{'last'});
+$frame = int($state {'last'})+1;
+
+if (($timer > 0) && ($frame < $last)) {
+ $timer = int($timer / ($last - $frame));
}
else {
- unless (flock($fh, 2)) {
- print "NO STATELOCK\n";
+ $timer=0;
+}
+
+if ($static_timer > $timer) {
+ $timer = $static_timer;
+}
+$next_ong = $ongtime + ($timer*3600);
+$state{'nextong'} = $next_ong;
+print 'next ongtime: '.$next_ong.' (+'.$timer.")\n";
+$state{'ongtime'}=$timer;
+
+if ($ongstate == STATE->{'ready'}) {
+ print 'next frame: '.$frame."\n";
+
+ %default = read_data_file(DATA_DEFAULT_PATH());
+ %frame_data = read_data_file(
+ join_path(PATH_SEPARATOR(), DATA_PATH(), $frame)
+ );
+ # %goto_list = read_data_file(DATA_LIST_PATH());
+
+ $new_state{'last'} = $frame;
+ $new_state{'state'} = 1;
+ $new_state{'ip1'} = '';
+ $new_state{'ip2'} = '';
+ $new_state{'ip3'} = '';
+ $new_state{'ongtime'}= $timer;
+
+ if ($frame >= 1) {
+ %frame_1_data = read_data_file(
+ join_path(PATH_SEPARATOR(), DATA_PATH(), $frame-1)
+ );
+ }
+ if ($frame >= 2) {
+ %frame_2_data = read_data_file(
+ join_path(PATH_SEPARATOR(), DATA_PATH(), $frame-2)
+ );
+ }
+ if ($frame >= 3) {
+ %frame_3_data = read_data_file(
+ join_path(PATH_SEPARATOR(), DATA_PATH(), $frame-3)
+ );
+ }
+
+ $r = ong (
+ $frame, # frame ID
+ $time, # ONG time
+ $timer, # timer to next ONG
+ 0, # update
+ 1, # print
+ \%settings,
+ \%default,
+ \%frame_data,
+ '' # \%goto_list
+ );
+ if ($r && ($frame >= 2)) {
+ print 'static page '.($frame-1);
+ $r = write_static_viewer_page(
+ $frame-1, # frame ID
+ \%new_state,
+ \%settings,
+ \%default,
+ \%frame_1_data, # frame data
+ \%frame_2_data, # prev frame data
+ \%frame_data, # next frame data
+ '' # words data
+ );
+ print (($r) ? " OK\n" : " FAIL\n");
+ }
+ if ($r && ($frame >= 3)) {
+ print 'static page '.($frame-2);
+ $r = write_static_viewer_page(
+ $frame-2, # frame ID
+ \%new_state,
+ \%settings,
+ \%default,
+ \%frame_2_data, # frame data
+ \%frame_3_data, # prev frame data
+ \%frame_1_data, # next frame data
+ '' # words data
+ );
+ print (($r) ? " OK\n" : " FAIL\n");
+ }
+ if ($r && ($frame <= 2)) {
+ print 'index';
+ $r = write_index(
+ \%new_state,
+ \%settings
+ );
+ print (($r) ? " OK\n" : " FAIL\n");
+ }
+ if ($r) {
+ print 'static GOTO';
+ $r = write_static_goto(
+ \%new_state,
+ \%settings,
+ '' # \%goto_list
+ );
+ print (($r) ? " OK\n" : " FAIL\n");
+ }
+ if ($r) {
+ %state = %new_state;
+ print "ONG\n\n";
}
else {
- %state = read_data_file($fh);
- $ongstate = int($state{'state'});
- print 'state: '.$ongstate."\n";
- unless ($ongstate > STATE->{'inactive'}) {
- print "INACTIVE\n";
- }
- else {
- $next_ong = int($state{'nextong'});
- print 'ongtime: '.$next_ong."\n";
-
- unless ($ongtime >= $next_ong) {
- print "WAIT\n";
- }
- else {
- %settings = read_data_file(DATA_SETTINGS_PATH());
- $static_timer = int($settings{'ongtime'});
- $timer = int($settings{'dynamicongtime'});
- $last = int($settings{'last'});
- $frame = int($state {'last'})+1;
-
- if (($timer > 0) && ($frame < $last)) {
- $timer = int($timer / ($last - $frame));
- }
- else {
- $timer=0;
- }
-
- if ($static_timer > $timer) {
- $timer = $static_timer;
- }
- $next_ong = $ongtime + ($timer*3600);
- $state{'nextong'} = $next_ong;
- print 'next ongtime: '.$next_ong.' (+'.$timer.")\n";
- $state{'ongtime'}=$timer;
-
- if ($ongstate == STATE->{'ready'}) {
- print 'next frame: '.$frame."\n";
-
- %default = read_data_file(DATA_DEFAULT_PATH());
- %frame_data = read_data_file(
- join_path(PATH_SEPARATOR(), DATA_PATH(), $frame)
- );
-
- $r = ong (
- $frame, # frame ID
- $time, # ONG time
- $timer, # timer to next ONG
- 0, # update
- 1, # print
- \%settings,
- \%default,
- \%frame_data,
- '' # %goto_list
- );
- if ($r) {
- $state{'last'} = $frame;
- $state{'state'} = 1;
- $state{'ip1'} = '';
- $state{'ip2'} = '';
- $state{'ip3'} = '';
- $state{'ongtime'}= $timer;
- print "ONG\n";
-
- my %frame_1_data;
- my %frame_2_data;
- my %frame_3_data;
- if ($frame >= 1) {
- %frame_1_data = read_data_file(
- join_path(PATH_SEPARATOR(), DATA_PATH(), $frame-1)
- );
- }
- if ($frame >= 2) {
- %frame_2_data = read_data_file(
- join_path(PATH_SEPARATOR(), DATA_PATH(), $frame-2)
- );
- }
- if ($frame >= 3) {
- %frame_3_data = read_data_file(
- join_path(PATH_SEPARATOR(), DATA_PATH(), $frame-3)
- );
- }
- if ($frame >= 2)
- {
- print 'static page '.($frame-1);
- $r = write_static_viewer_page(
- $frame-1, # frame ID
- \%state,
- \%settings,
- \%default,
- \%frame_1_data, # frame data
- \%frame_2_data, # prev frame data
- \%frame_data, # next frame data
- '' # words data
- );
- print (($r) ? " OK\n" : " FAIL\n");
- }
- if ($frame >= 3)
- {
- print 'static page '.($frame-2);
- $r = write_static_viewer_page(
- $frame-2, # frame ID
- \%state,
- \%settings,
- \%default,
- \%frame_2_data, # frame data
- \%frame_3_data, # prev frame data
- \%frame_1_data, # next frame data
- '' # words data
- );
- print (($r) ? " OK\n" : " FAIL\n");
- }
- if ($frame <= 2) {
- print 'index';
- $r = write_index(
- \%state,
- \%settings
- );
- print (($r) ? " OK\n" : " FAIL\n");
- }
- }
- else {
- print "NO ONG\n";
- }
- }
- write_data_file($fh, \%state);
- }
- }
+ print "NO ONG\n\n";
}
- close ($fh);
}
-
-print "\n";
\ No newline at end of file
+write_data_file($fh, \%state);
+close ($fh);
_cgi_frame_path = @_PATH( $cgi_path, f )
_cgi_goto_path = @_PATH( $cgi_path, g )
_cgi_info_path = @_PATH( $cgi_path, i )
+_cgi_list_path = @_PATH( $cgi_path, goto.htm )
_cgi_logo_path = @_PATH( $cgi_path, botmlogo.png)
_cgi_timer_path = @_PATH( $cgi_path, timer.js )
_cgi_viewer_path = @_PATH( $cgi_path, v )
_log_words_path = @_PATH( $log_path, words.log )
_www_path = @_PATH( $www_path, )
+_www_goto_path = @_PATH( $www_path, goto.htm )
_www_index_path = @_PATH( $www_path, index.htm)
_conf_path = @_PATH($conf_path, $name\.conf)
PERL_CGI_FRAME_PATH = @_PERL_CONSTANT_STR( CGI_FRAME_PATH , $_cgi_frame_path )
PERL_CGI_GOTO_PATH = @_PERL_CONSTANT_STR( CGI_GOTO_PATH , $_cgi_goto_path )
PERL_CGI_INFO_PATH = @_PERL_CONSTANT_STR( CGI_INFO_PATH , $_cgi_info_path )
+PERL_CGI_LIST_PATH = @_PERL_CONSTANT_STR( CGI_LIST_PATH , $_cgi_list_path )
PERL_CGI_LOGO_PATH = @_PERL_CONSTANT_STR( CGI_LOGO_PATH , $_cgi_logo_path )
PERL_CGI_TIMER_PATH = @_PERL_CONSTANT_STR( CGI_TIMER_PATH , $_cgi_timer_path )
PERL_CGI_VIEWER_PATH = @_PERL_CONSTANT_STR( CGI_VIEWER_PATH, $_cgi_viewer_path)
-PERL_CGI_WORDS_PATH = @_PERL_CONSTANT_STR( CGI_WORDS_PATH, $_cgi_words_path)
+PERL_CGI_WORDS_PATH = @_PERL_CONSTANT_STR( CGI_WORDS_PATH , $_cgi_words_path )
PERL_DATA_PATH = @_PERL_CONSTANT_STR( DATA_PATH , $_data_path )
PERL_DATA_ATTACH_PATH = @_PERL_CONSTANT_STR( DATA_ATTACH_PATH , $_data_attach_path )
PERL_LOG_WORDS_PATH = @_PERL_CONSTANT_STR( LOG_WORDS_PATH, $_log_words_path)
PERL_WWW_PATH = @_PERL_CONSTANT_STR( WWW_PATH , $_www_path )
+PERL_WWW_GOTO_PATH = @_PERL_CONSTANT_STR( WWW_GOTO_PATH , $_www_goto_path )
PERL_WWW_INDEX_PATH = @_PERL_CONSTANT_STR( WWW_INDEX_PATH, $_www_index_path)
PERL_SCHEME = @_PERL_CONSTANT_STR( SCHEME , $scheme )
-###RUN_PERL: #!/usr/bin/perl
+#!/usr/bin/perl
# update.pl is generated from update.1.pl.
#
use Encode::Locale ('decode_argv');
use Encode ('encode', 'decode');
-###PERL_LIB: use lib /botm/lib/bsta
+use lib '/botm/lib/test-bsta';
use botm_common (
'read_data_file',
'join_path'
use bsta_lib (
'STATE',
'ong',
- 'write_index', 'write_static_viewer_page'
+ 'write_index', 'write_static_viewer_page', 'write_static_goto'
);
###PERL_PATH_SEPARATOR: PATH_SEPARATOR = /
my %all_frame_data = ();
my %all_words_data = ();
+my $update_goto = 0;
+
my $ong_state = int($state{'state'});
my $last_frame = ($ong_state > STATE->{'inactive'}) ?
int($state{'last'}) :
foreach my $id (@ARGV) {
if ($id eq 'all') {
+ $update_goto = 1;
push @list, 'i';
push @list, 'c';
for (my $f=0; $f<=$last_frame; $f+=1) {
}
}
elsif ($id =~ /^[0-9]+$/) {
+ $update_goto = 1;
my $f = int($&);
if ($f <= $last_frame) {
push @list, $f
}
make_static_pages($id);
}
+if ($update_goto) {
+ print 'static GOTO';
+ my $r = write_static_goto(
+ \%state,
+ \%settings,
+ '' # \%goto_list
+ );
+ if ($r) {
+ print " OK\n";
+ }
+ else {
+ print " FAIL\n";
+ $fail += 1;
+ }
+}
+
print "\n";
return;
}
my $f = int($id);
- unless (($f >= 0) && ($f <= $last_frame)) {
+ unless (
+ ($f >= 0) && (
+ ($f < $last_frame-1) || (
+ ($ong_state >= STATE->{'ready'}) &&
+ ($f <= $last_frame-1)
+ ) || (
+ ($ong_state >= STATE->{'end'}) &&
+ ($f <= $last_frame)
+ )
+ )
+ ) {
return;
}
my $r;
'fail_method', 'fail_content_type', 'redirect',
'get_remote_addr', 'get_frame', 'get_password',
'merge_settings',
- 'print_viewer_page', 'write_index',
+ 'print_viewer_page', 'write_index', 'write_static_goto',
'ong'
);
###PERL_DATA_PATH: DATA_PATH = /botm/data/bsta/
###PERL_DATA_DEFAULT_PATH: DATA_DEFAULT_PATH = /botm/data/bsta/default
+###PERL_DATA_LIST_PATH: DATA_LIST_PATH = /botm/data/bsta/list
###PERL_DATA_NOACCESS_PATH: DATA_NOACCESS_PATH = /botm/data/bsta/noaccess
###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
###PERL_DATA_STATE_PATH: DATA_STATE_PATH = /botm/data/bsta/state
elsif ($state{'ip3'} eq '') {
$new_state{'ip3'} = $IP;
$new_state{'state'} = STATE->{'ready'};
+ write_static_goto(\%new_state, \%settings, '');
}
else {
$new_state{'state'} = STATE->{'ready'};
+ write_static_goto(\%new_state, \%settings, '');
}
write_data_file($fh, \%new_state);
}
my $r;
%story = read_data_file(DATA_STORY_PATH());
+ %goto_list = read_data_file(DATA_LIST_PATH());
if (
(int($story{'state'}) == INTF_STATE->{'>|'} ) &&
\%settings,
\%default,
\%frame_data,
- '' # %goto_list
+ \%goto_list
);
if ($r) {
$r = write_index(\%state, \%settings);
}
+ if ($r) {
+ $r = write_static_goto(\%state, \%settings, \%goto_list);
+ }
if ($r) {
$r = write_data_file($fh, \%state);
}