version 1.40, 2004/01/15 20:22:47
|
version 1.45, 2004/02/03 21:52:22
|
Line 90 sub authorbombs {
|
Line 90 sub authorbombs {
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
|
sub recent_filename { |
|
my $area=shift; |
|
return 'nohist_recent_'.&Apache::lonnet::escape($area); |
|
} |
|
|
|
sub store_recent { |
|
my ($area,$name,$value)=@_; |
|
my $file=&recent_filename($area); |
|
my %recent=&Apache::lonnet::dump($file); |
|
if (scalar(keys(%recent))>10) { |
|
# remove oldest value |
|
my $oldest=time; |
|
my $delkey=''; |
|
foreach (keys %recent) { |
|
my $thistime=(split(/\&/,$recent{$_}))[0]; |
|
if ($thistime<$oldest) { |
|
$oldest=$thistime; |
|
$delkey=$_; |
|
} |
|
} |
|
&Apache::lonnet::del($file,[$delkey]); |
|
} |
|
# store new value |
|
&Apache::lonnet::put($file,{ $name => |
|
time.'&'.&Apache::lonnet::escape($value) }); |
|
} |
|
|
|
sub select_recent { |
|
my ($area,$fieldname,$event)=@_; |
|
my %recent=&Apache::lonnet::dump(&recent_filename($area)); |
|
my $return="\n<select name='$fieldname'". |
|
($event?" onChange='$event'":''). |
|
">\n<option value=''>--- ".&mt('Recent')." ---</option>"; |
|
foreach (sort keys %recent) { |
|
unless ($_=~/^error\:/) { |
|
$return.="\n<option value='$_'>". |
|
&Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]). |
|
'</option>'; |
|
} |
|
} |
|
$return.="\n</select>\n"; |
|
return $return; |
|
} |
|
|
|
|
=pod |
=pod |
|
|
=item textbox |
=item textbox |
Line 781 Returns: none
|
Line 826 Returns: none
|
# Create progress |
# Create progress |
sub Create_PrgWin { |
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 |
|
#in mozilla Read BUG #2665 if you want to know the whole story |
$r->print('<script>'. |
$r->print('<script>'. |
"popwin=open(\'\',\'popwin\',\'width=400,height=100\');". |
"var popwin; |
|
function openpopwin () { |
|
popwin=open(\'\',\'popwin\',\'width=400,height=100\');". |
"popwin.document.writeln(\'<html><head><title>$title</title></head>". |
"popwin.document.writeln(\'<html><head><title>$title</title></head>". |
"<body bgcolor=\"#88DDFF\">". |
"<body bgcolor=\"#88DDFF\">". |
"<h4>$heading</h4>". |
"<h4>$heading</h4>". |
Line 790 sub Create_PrgWin {
|
Line 839 sub Create_PrgWin {
|
'<input type="text" size="55" name="remaining" value="'. |
'<input type="text" size="55" name="remaining" value="'. |
&mt('Starting').'"></form>'. |
&mt('Starting').'"></form>'. |
"</body></html>\');". |
"</body></html>\');". |
"popwin.document.close();". |
"popwin.document.close();}". |
"</script>"); |
"\nwindow.setTimeout(openpopwin,0)</script>"); |
|
|
my %prog_state; |
my %prog_state; |
$prog_state{'done'}=0; |
$prog_state{'done'}=0; |
Line 876 sub Close_PrgWin {
|
Line 925 sub Close_PrgWin {
|
# ------------------------------------------------------- Puts directory header |
# ------------------------------------------------------- Puts directory header |
|
|
sub crumbs { |
sub crumbs { |
my ($uri,$target,$prefix)=@_; |
my ($uri,$target,$prefix,$form)=@_; |
my $output='<br /><tt><b><font size="+2">'.$prefix.'/'; |
my $output='<br /><tt><b><font size="+2">'.$prefix.'/'; |
if ($ENV{'user.adv'}) { |
if ($ENV{'user.adv'}) { |
my $path=$prefix; |
my $path=$prefix.'/'; |
foreach (split('/',$uri)) { |
foreach (split('/',$uri)) { |
unless ($_) { next; } |
unless ($_) { next; } |
$path.='/'.$_; |
$path.=$_; |
$output.='<a href="'.$path.'"'.($target?' target="'.$target.'"':'').'>'.$_.'</a>/'; |
unless ($path eq $uri) { $path.='/'; } |
|
my $linkpath=$path; |
|
if ($form) { |
|
$linkpath="javascript:$form.action='$path';$form.submit();"; |
|
} |
|
$output.='<a href="'.$linkpath.'"'.($target?' target="'.$target.'"':'').'>'.$_.'</a>/'; |
} |
} |
} else { |
} else { |
$output.=$uri; |
$output.=$uri; |