version 1.93, 2004/10/12 23:26:48
|
version 1.103, 2005/02/17 08:29:42
|
Line 80 sub authorbombs {
|
Line 80 sub authorbombs {
|
foreach (keys %bombs) { |
foreach (keys %bombs) { |
if ($_=~/^$udom\/$uname\//) { |
if ($_=~/^$udom\/$uname\//) { |
return '<a href="/adm/bombs/'.$url. |
return '<a href="/adm/bombs/'.$url. |
'"><img src="/adm/lonMisc/bomb.gif" border="0" /></a>'. |
'"><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/bomb.gif').'" border="0" /></a>'. |
&Apache::loncommon::help_open_topic('About_Bombs'); |
&Apache::loncommon::help_open_topic('About_Bombs'); |
} |
} |
} |
} |
Line 127 sub select_recent {
|
Line 127 sub select_recent {
|
my ($area,$fieldname,$event)=@_; |
my ($area,$fieldname,$event)=@_; |
my %recent=&Apache::lonnet::dump(&recent_filename($area)); |
my %recent=&Apache::lonnet::dump(&recent_filename($area)); |
my $return="\n<select name='$fieldname'". |
my $return="\n<select name='$fieldname'". |
($event?" onChange='$event'":''). |
($event?" onchange='$event'":''). |
">\n<option value=''>--- ".&mt('Recent')." ---</option>"; |
">\n<option value=''>--- ".&mt('Recent')." ---</option>"; |
foreach (sort keys %recent) { |
foreach (sort keys %recent) { |
unless ($_=~/^error\:/) { |
unless ($_=~/^error\:/) { |
$return.="\n<option value='$_'>". |
my $escaped = &Apache::loncommon::escape_url($_); |
|
$return.="\n<option value='$escaped'>". |
&Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]). |
&Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]). |
'</option>'; |
'</option>'; |
} |
} |
Line 140 sub select_recent {
|
Line 141 sub select_recent {
|
return $return; |
return $return; |
} |
} |
|
|
|
sub get_recent { |
|
my ($area, $n) = @_; |
|
my %recent=&Apache::lonnet::dump(&recent_filename($area)); |
|
|
|
# Create hash with key as time and recent as value |
|
my %time_hash = (); |
|
foreach (keys %recent) { |
|
my $thistime=(split(/\&/,$recent{$_}))[0]; |
|
$time_hash{$thistime} = $_; |
|
} |
|
|
|
# Sort by decreasing time and return key value pairs |
|
my %return_hash = (); |
|
my $idx = 1; |
|
foreach (reverse sort keys %time_hash) { |
|
$return_hash{$time_hash{$_}} = |
|
&Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]); |
|
if ($n && ($idx++ >= $n)) {last;} |
|
} |
|
|
|
return %return_hash; |
|
} |
|
|
|
|
|
|
=pod |
=pod |
|
|
Line 286 sub date_setter {
|
Line 311 sub date_setter {
|
document.$formname.$dname\_day.value = 30; |
document.$formname.$dname\_day.value = 30; |
} |
} |
} |
} |
|
|
function $dname\_disable() { |
function $dname\_disable() { |
document.$formname.$dname\_month.disabled=true; |
document.$formname.$dname\_month.disabled=true; |
document.$formname.$dname\_day.disabled=true; |
document.$formname.$dname\_day.disabled=true; |
Line 318 document.$formname.$dname\_year.value,
|
Line 343 document.$formname.$dname\_year.value,
|
} |
} |
</script> |
</script> |
ENDJS |
ENDJS |
$result .= " <nobr><select name=\"$dname\_month\" ".$special.' '. |
$result .= ' <nobr>'; |
$state.' '. |
my $monthselector = qq{<select name="$dname\_month" $special $state onchange="javascript:$dname\_checkday()" >}; |
"onChange=\"javascript:$dname\_checkday()\" >\n"; |
|
# Month |
# Month |
my @Months = qw/January February March April May June |
my @Months = qw/January February March April May June |
July August September October November December/; |
July August September October November December/; |
# Pad @Months with a bogus value to make indexing easier |
# Pad @Months with a bogus value to make indexing easier |
unshift(@Months,'If you can read this an error occurred'); |
unshift(@Months,'If you can read this an error occurred'); |
if ($includeempty) { $result.="<option value=''></option>"; } |
if ($includeempty) { $monthselector.="<option value=''></option>"; } |
for(my $m = 1;$m <=$#Months;$m++) { |
for(my $m = 1;$m <=$#Months;$m++) { |
$result .= " <option value=\"$m\" "; |
$monthselector .= qq{ <option value="$m" }; |
$result .= "selected " if ($m-1 eq $month); |
$monthselector .= "selected " if ($m-1 eq $month); |
$result .= "> ".&mt($Months[$m])." </option>\n"; |
$monthselector .= '> '.&mt($Months[$m]).' </option>'; |
} |
} |
$result .= " </select>\n"; |
$monthselector.= ' </select>'; |
# Day |
# Day |
$result .= " <input type=\"text\" name=\"$dname\_day\" ".$state.' '. |
my $dayselector = qq{<input type="text" name="$dname\_day" $state value="$mday" size="3" $special onchange="javascript:$dname\_checkday()" />}; |
"value=\"$mday\" size=\"3\" ".$special.' '. |
|
"onChange=\"javascript:$dname\_checkday()\" />\n"; |
|
# Year |
# Year |
$result .= " <input type=\"year\" name=\"$dname\_year\" ".$state.' '. |
my $yearselector = qq{<input type="year" name="$dname\_year" $state value="$year" size="5" $special onchange="javascript:$dname\_checkday()" />}; |
"value=\"$year\" size=\"5\" ".$special.' '. |
# |
"onChange=\"javascript:$dname\_checkday()\" />\n"; |
my $hourselector = qq{<select name="$dname\_hour" $special $state >}; |
$result .= " "; |
if ($includeempty) { |
if (! $no_hh_mm_ss) { |
$hourselector.=qq{<option value=''></option>}; |
# Hours |
} |
$result .= " <select name=\"$dname\_hour\" ".$special." ".$state.' '. |
for (my $h = 0;$h<24;$h++) { |
">\n"; |
$hourselector .= qq{<option value="$h" }; |
if ($includeempty) { $result.="<option value=''></option>"; } |
$hourselector .= "selected " if (defined($hour) && $hour == $h); |
for (my $h = 0;$h<24;$h++) { |
$hourselector .= ">"; |
$result .= " <option value=\"$h\" "; |
my $timest=''; |
$result .= "selected " if (defined($hour) && $hour == $h); |
if ($h == 0) { |
$result .= "> "; |
$timest .= "12 am"; |
my $timest=''; |
} elsif($h == 12) { |
if ($h == 0) { |
$timest .= "12 noon"; |
$timest .= "12 am"; |
} elsif($h < 12) { |
} elsif($h == 12) { |
$timest .= "$h am"; |
$timest .= "12 noon"; |
} else { |
} elsif($h < 12) { |
$timest .= $h-12 ." pm"; |
$timest .= "$h am"; |
} |
} else { |
$timest=&mt($timest); |
$timest .= $h-12 ." pm"; |
$hourselector .= $timest." </option>\n"; |
} |
|
$timest=&mt($timest); |
|
$result .= $timest." </option>\n"; |
|
} |
|
$result .= " </select>\n"; |
|
$result .= " <input type=\"text\" name=\"$dname\_minute\" ". |
|
$special.' '. |
|
$state.' '. |
|
"value=\"$min\" size=\"3\" /> m\n"; |
|
$result .= " <input type=\"text\" name=\"$dname\_second\" ". |
|
$special.' '. |
|
$state.' '. |
|
"value=\"$sec\" size=\"3\" /> s\n"; |
|
} |
} |
$result .= "<a href=\"javascript:$dname\_opencalendar()\">". |
$hourselector .= " </select>\n"; |
&mt('Select Date')."</a></nobr>\n<!-- end $dname date setting form -->\n"; |
my $minuteselector = qq{<input type="text" name="$dname\_minute" $special $state value="$min" size="3" />}; |
|
my $secondselector= qq{<input type="text" name="$dname\_second" $special $state value="$sec" size="3" />}; |
|
my $cal_link = qq{<a href="javascript:$dname\_opencalendar()">}; |
|
# |
|
if ($no_hh_mm_ss) { |
|
$result .= &mt('[_1] [_2] [_3] [_4]Select Date[_5]', |
|
$monthselector,$dayselector,$yearselector, |
|
$cal_link,'</a>'); |
|
} else { |
|
$result .= &mt('[_1] [_2] [_3] [_4] [_5]m [_6]s [_7]Select Date[_8]', |
|
$monthselector,$dayselector,$yearselector, |
|
$hourselector,$minuteselector,$secondselector, |
|
$cal_link,'</a>'); |
|
} |
|
$result .= "</nobr>\n<!-- end $dname date setting form -->\n"; |
return $result; |
return $result; |
} |
} |
|
|
Line 736 sub Create_PrgWin {
|
Line 759 sub Create_PrgWin {
|
$prog_state{'type'}=$type; |
$prog_state{'type'}=$type; |
if ($type eq 'popup') { |
if ($type eq 'popup') { |
$prog_state{'window'}='popwin'; |
$prog_state{'window'}='popwin'; |
|
my $html=&Apache::lonxml::xmlbegin(); |
#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($r,'<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\');". |
"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>". |
"<form name=popremain>". |
"<form name=popremain>". |
Line 876 sub crumbs {
|
Line 900 sub crumbs {
|
if (! defined($size)) { |
if (! defined($size)) { |
$size = '+2'; |
$size = '+2'; |
} |
} |
|
if ($target) { |
|
$target = ' target="'. |
|
&Apache::loncommon::escape_single($target).'"'; |
|
} |
my $output=''; |
my $output=''; |
unless ($noformat) { $output.='<br /><tt><b>'; } |
unless ($noformat) { $output.='<br /><tt><b>'; } |
$output.='<font size="'.$size.'">'.$prefix.'/'; |
$output.='<font size="'.$size.'">'.$prefix.'/'; |
if ($ENV{'user.adv'}) { |
if ($ENV{'user.adv'}) { |
my $path=$prefix.'/'; |
my $path=$prefix.'/'; |
foreach (split('/',$uri)) { |
foreach my $dir (split('/',$uri)) { |
unless ($_) { next; } |
if (! $dir) { next; } |
$path.=$_; |
$path .= $dir; |
unless ($path eq $uri) { $path.='/'; } |
unless ($path eq $uri) { $path.='/'; } |
my $linkpath=$path; |
my $linkpath = &Apache::loncommon::escape_single($path); |
if ($form) { |
if ($form) { |
$linkpath="javascript:$form.action='$path';$form.submit();"; |
$linkpath= |
} |
qq{javascript:$form.action='$linkpath';$form.submit();}; |
$output.='<a href="'.$linkpath.'"'.($target?' target="'.$target.'"':'').'>'.$_.'</a>/'; |
} |
|
$output.=qq{<a href="$linkpath" $target>$dir</a>/}; |
} |
} |
} else { |
} else { |
$output.=$uri; |
$output.=$uri; |
Line 901 sub crumbs {
|
Line 930 sub crumbs {
|
# --------------------- A function that generates a window for the spellchecker |
# --------------------- A function that generates a window for the spellchecker |
|
|
sub spellheader { |
sub spellheader { |
my $nothing = &javascript_nothing(); |
my $html=&Apache::lonxml::xmlbegin(); |
return (<<ENDCHECK); |
return (<<ENDCHECK); |
<script type="text/javascript"> |
<script type="text/javascript"> |
//<!-- BEGIN LON-CAPA Internal |
//<!-- BEGIN LON-CAPA Internal |
var checkwin; |
var checkwin; |
|
|
function spellcheckerwindow() { |
function spellcheckerwindow() { |
checkwin=window.open($nothing,'spellcheckwin','height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); |
checkwin=window.open('/adm/rat/empty.html','spellcheckwin','height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); |
checkwin.document.writeln('<html><body bgcolor="#DDDDDD"><form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="" /></form></body></html>'); |
checkwin.document.writeln('$html<head></head><body bgcolor="#DDDDDD"><form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="" /></form></body></html>'); |
checkwin.document.close(); |
checkwin.document.close(); |
} |
} |
// END LON-CAPA Internal --> |
// END LON-CAPA Internal --> |