version 1.93, 2004/10/12 23:26:48
|
version 1.98, 2004/11/23 14:53:05
|
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 885 sub crumbs {
|
Line 908 sub crumbs {
|
unless ($_) { next; } |
unless ($_) { next; } |
$path.=$_; |
$path.=$_; |
unless ($path eq $uri) { $path.='/'; } |
unless ($path eq $uri) { $path.='/'; } |
my $linkpath=$path; |
my $escaped_linkpath = &Apache::loncommon::escape_single($path); |
if ($form) { |
if ($form) { |
$linkpath="javascript:$form.action='$path';$form.submit();"; |
$escaped_linkpath="javascript:$form.action='". |
} |
&Apache::loncommon::escape_single($path). |
$output.='<a href="'.$linkpath.'"'.($target?' target="'.$target.'"':'').'>'.$_.'</a>/'; |
"';$form.submit();"; |
|
} |
|
my $escaped_target = &Apache::loncommon::escape_single($target); |
|
$output.='<a href="'.$escaped_linkpath.'"'.($target?' target="'.$escaped_target.'"':'').'>'.$_.'</a>/'; |
} |
} |
} else { |
} else { |
$output.=$uri; |
$output.=$uri; |