ProgressBar tweaks

Output skips macro processing
Modperl buffering is side-stepped ($|++)
Modproxy buffering is side-stepped (output size)
Javascript extensibility
This commit is contained in:
Patrick Donelan 2009-06-19 02:02:20 +00:00
parent fb38e45343
commit 235037baa5

View file

@ -82,8 +82,8 @@ sub finish {
parent.location.href='%s'; parent.location.href='%s';
</script> </script>
EOJS EOJS
$self->session->output->print($text . $self->{_foot}); $self->session->output->print($text . $self->{_foot}, 1); # skipMacros
return 'redirect'; return 'chunked';
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -125,8 +125,9 @@ sub start {
my $template = WebGUI::Asset::Template->new($self->session, 'YP9WaMPJHvCJl-YwrLVcPw'); my $template = WebGUI::Asset::Template->new($self->session, 'YP9WaMPJHvCJl-YwrLVcPw');
my $output = $self->session->style->process($template->process(\%var).'~~~', "PBtmpl0000000000000137"); my $output = $self->session->style->process($template->process(\%var).'~~~', "PBtmpl0000000000000137");
my ($head, $foot) = split '~~~', $output; my ($head, $foot) = split '~~~', $output;
local $| = 1; # Tell modperl not to buffer the output
$self->session->http->sendHeader; $self->session->http->sendHeader;
$self->session->output->print($head); $self->session->output->print($head, 1); #skipMacros
$self->{_foot} = $foot; $self->{_foot} = $foot;
return ''; return '';
} }
@ -148,13 +149,16 @@ sub update {
my $message = shift; ##JS string escaping? my $message = shift; ##JS string escaping?
$self->session->log->preventDebugOutput; $self->session->log->preventDebugOutput;
$self->{_counter} += 1; $self->{_counter} += 1;
my $modproxy_buffer_breaker = 'BUFFER BREAKER ' x 1000;
my $text = sprintf(<<EOJS, $self->{_counter}, $message); my $text = sprintf(<<EOJS, $self->{_counter}, $message);
<script> <script type="text/javascript">
document.getElementById("progressMeter").style.width='%dpx'; /* $modproxy_buffer_breaker */
document.getElementById("progressStatus").innerHTML='%s'; updateWgProgressBar('%dpx', '%s');
</script> </script>
EOJS EOJS
$self->session->output->print($text); local $| = 1; # Tell modperl not to buffer the output
$self->session->output->print($text, 1); #skipMacros
if ($self->{_counter} > 600) { if ($self->{_counter} > 600) {
$self->{_counter} = 1; $self->{_counter} = 1;
} }