version 1.46, 2004/02/12 22:23:30
|
version 1.48, 2004/02/16 21:49:16
|
Line 56 html.
|
Line 56 html.
|
package Apache::lonhtmlcommon; |
package Apache::lonhtmlcommon; |
|
|
use Time::Local; |
use Time::Local; |
|
use Time::HiRes; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use strict; |
use strict; |
|
|
Line 629 sub Create_PrgWin {
|
Line 630 sub Create_PrgWin {
|
my ($r, $title, $heading, $number_to_do)=@_; |
my ($r, $title, $heading, $number_to_do)=@_; |
#the whole function called through timeout is due to issues |
#the whole function called through timeout is due to issues |
#in mozilla Read BUG #2665 if you want to know the whole story |
#in mozilla Read BUG #2665 if you want to know the whole story |
$r->print('<script>'. |
&r_print($r,'<script>'. |
"var popwin; |
"var popwin; |
function openpopwin () { |
function openpopwin () { |
popwin=open(\'\',\'popwin\',\'width=400,height=100\');". |
popwin=open(\'\',\'popwin\',\'width=400,height=100\');". |
Line 649 sub Create_PrgWin {
|
Line 650 sub Create_PrgWin {
|
$prog_state{'laststart'}=&Time::HiRes::time(); |
$prog_state{'laststart'}=&Time::HiRes::time(); |
$prog_state{'max'}=$number_to_do; |
$prog_state{'max'}=$number_to_do; |
|
|
$r->rflush(); |
|
return %prog_state; |
return %prog_state; |
} |
} |
|
|
# update progress |
# update progress |
sub Update_PrgWin { |
sub Update_PrgWin { |
my ($r,$prog_state,$displayString)=@_; |
my ($r,$prog_state,$displayString)=@_; |
$r->print('<script>popwin.document.popremain.remaining.value="'. |
&r_print($r,'<script>popwin.document.popremain.remaining.value="'. |
$displayString.'";</script>'); |
$displayString.'";</script>'); |
$$prog_state{'laststart'}=&Time::HiRes::time(); |
$$prog_state{'laststart'}=&Time::HiRes::time(); |
$r->rflush(); |
|
} |
} |
|
|
# increment progress state |
# increment progress state |
Line 707 sub Increment_PrgWin {
|
Line 706 sub Increment_PrgWin {
|
if ($user_browser eq 'explorer' && $user_os =~ 'mac') { |
if ($user_browser eq 'explorer' && $user_os =~ 'mac') { |
$lasttime = ''; |
$lasttime = ''; |
} |
} |
$r->print('<script>popwin.document.popremain.remaining.value="'. |
&r_print($r,'<script>popwin.document.popremain.remaining.value="'. |
$$prog_state{'done'}.'/'.$$prog_state{'max'}. |
$$prog_state{'done'}.'/'.$$prog_state{'max'}. |
': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'.'</script>'); |
': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'.'</script>'); |
$$prog_state{'laststart'}=&Time::HiRes::time(); |
$$prog_state{'laststart'}=&Time::HiRes::time(); |
$r->rflush(); |
|
} |
} |
|
|
# close Progress Line |
# close Progress Line |
sub Close_PrgWin { |
sub Close_PrgWin { |
my ($r,$prog_state)=@_; |
my ($r,$prog_state)=@_; |
$r->print('<script>popwin.close()</script>'."\n"); |
&r_print($r,'<script>popwin.close()</script>'."\n"); |
undef(%$prog_state); |
undef(%$prog_state); |
$r->rflush(); |
|
} |
} |
|
|
|
sub r_print { |
|
my ($r,$to_print)=@_; |
|
if ($r) { |
|
$r->print($to_print); |
|
$r->rflush(); |
|
} else { |
|
print($to_print); |
|
} |
|
} |
|
|
# ------------------------------------------------------- Puts directory header |
# ------------------------------------------------------- Puts directory header |
|
|