Apache-UploadMeter

 view release on metacpan or  search on metacpan

javascript.pod  view on Meta::CPAN

onInitialize(I<status>, I<last>)

This callback is called once after the initial AJAX response is received and
parsed.  While I<last> is generally useless at this point (it's a subset of
I<status> right now), it's provided in case you want to change the value of
anything in it.

=item *
onUpdate(I<status>, I<last>)

This callback is called every time data is updated from meter URL.  It can be
utilized to update other GUI elements, such as is done in the default pop-up.

=item *
onFinished(I<status>, I<last>)

This callback is called after onUpdate if the upload is determined to be complete
(eg, C<tatus.finished == 1>)

=back

lib/Apache/UploadMeter.pm  view on Meta::CPAN

        $hook_cache->remove($hook_id."finished");
        $hook_cache->remove($hook_id."len");
        $hook_cache->remove($hook_id."name");
        $hook_cache->remove($hook_id."size");
        $hook_cache->remove($hook_id."starttime");
        $hook_cache->remove($hook_id."lastupdaterate");
        $hook_cache->remove($hook_id."lastupdatelen");
	$hook_cache->clear;
	$hook_cache->purge; #best I can do for now...
    } else {
    	# Set a refresh header so the meter gets updated
	my $uri = APR::URI->parse($r->pool, $r->uri);
	$uri->scheme($ENV{HTTPS}?"https":"http");
	$uri->port($r->server->port ? $r->server->port : APR::URI::port_of_scheme($uri->scheme));
	$uri->path($r->uri);
	$uri->hostname($r->server->server_hostname);
	$uri->query($args);
        $r->headers_out->add("Refresh"=>"5;url=".$uri->unparse());
    }
    $r->content_type('text/xml');
    return Apache2::Const::OK if $r->header_only;



( run in 0.375 second using v1.01-cache-2.11-cpan-05444aca049 )