version 1.65, 2004/04/16 15:06:56
|
version 1.71, 2004/06/02 16:41:46
|
Line 163 sub textbox {
|
Line 163 sub textbox {
|
############################################## |
############################################## |
############################################## |
############################################## |
sub checkbox { |
sub checkbox { |
my ($name,$value) = @_; |
my ($name,$checked,$value) = @_; |
my $Str = '<input type="checkbox" name="'.$name.'"'. |
my $Str = '<input type="checkbox" name="'.$name.'" '; |
($value?' checked="1"':'').' />'; |
if (defined($value)) { |
|
$Str .= 'value="'.$value.'"'; |
|
} |
|
if ($checked) { |
|
$Str .= ' checked="1"'; |
|
} |
|
$Str .= ' />'; |
return $Str; |
return $Str; |
} |
} |
|
|
Line 219 The method used to restrict user input w
|
Line 225 The method used to restrict user input w
|
############################################## |
############################################## |
############################################## |
############################################## |
sub date_setter { |
sub date_setter { |
my ($formname,$dname,$currentvalue,$special,$includeempty,$state) = @_; |
my ($formname,$dname,$currentvalue,$special,$includeempty,$state, |
|
$no_hh_mm_ss) = @_; |
if (! defined($state) || $state ne 'disabled') { |
if (! defined($state) || $state ne 'disabled') { |
$state = ''; |
$state = ''; |
} |
} |
|
if (! defined($no_hh_mm_ss)) { |
|
$no_hh_mm_ss = 0; |
|
} |
if (! defined($currentvalue) || $currentvalue eq 'now') { |
if (! defined($currentvalue) || $currentvalue eq 'now') { |
unless ($includeempty) { |
unless ($includeempty) { |
$currentvalue = time; |
$currentvalue = time; |
Line 305 ENDJS
|
Line 315 ENDJS
|
$result .= " <nobr><select name=\"$dname\_month\" ".$special.' '. |
$result .= " <nobr><select name=\"$dname\_month\" ".$special.' '. |
$state.' '. |
$state.' '. |
"onChange=\"javascript:$dname\_checkday()\" >\n"; |
"onChange=\"javascript:$dname\_checkday()\" >\n"; |
|
# 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 |
Line 316 ENDJS
|
Line 327 ENDJS
|
$result .= "> ".&mt($Months[$m])." </option>\n"; |
$result .= "> ".&mt($Months[$m])." </option>\n"; |
} |
} |
$result .= " </select>\n"; |
$result .= " </select>\n"; |
|
# Day |
$result .= " <input type=\"text\" name=\"$dname\_day\" ".$state.' '. |
$result .= " <input type=\"text\" name=\"$dname\_day\" ".$state.' '. |
"value=\"$mday\" size=\"3\" ".$special.' '. |
"value=\"$mday\" size=\"3\" ".$special.' '. |
"onChange=\"javascript:$dname\_checkday()\" />\n"; |
"onChange=\"javascript:$dname\_checkday()\" />\n"; |
|
# Year |
$result .= " <input type=\"year\" name=\"$dname\_year\" ".$state.' '. |
$result .= " <input type=\"year\" name=\"$dname\_year\" ".$state.' '. |
"value=\"$year\" size=\"5\" ".$special.' '. |
"value=\"$year\" size=\"5\" ".$special.' '. |
"onChange=\"javascript:$dname\_checkday()\" />\n"; |
"onChange=\"javascript:$dname\_checkday()\" />\n"; |
$result .= " "; |
$result .= " "; |
$result .= " <select name=\"$dname\_hour\" ".$special." ".$state.' '.">\n"; |
if (! $no_hh_mm_ss) { |
if ($includeempty) { $result.="<option value=''></option>"; } |
# Hours |
for (my $h = 0;$h<24;$h++) { |
$result .= " <select name=\"$dname\_hour\" ".$special." ".$state.' '. |
$result .= " <option value=\"$h\" "; |
">\n"; |
$result .= "selected " if (defined($hour) && $hour == $h); |
if ($includeempty) { $result.="<option value=''></option>"; } |
$result .= "> "; |
for (my $h = 0;$h<24;$h++) { |
my $timest=''; |
$result .= " <option value=\"$h\" "; |
if ($h == 0) { |
$result .= "selected " if (defined($hour) && $hour == $h); |
$timest .= "12 am"; |
$result .= "> "; |
} elsif($h == 12) { |
my $timest=''; |
$timest .= "12 noon"; |
if ($h == 0) { |
} elsif($h < 12) { |
$timest .= "12 am"; |
$timest .= "$h am"; |
} elsif($h == 12) { |
} else { |
$timest .= "12 noon"; |
$timest .= $h-12 ." pm"; |
} elsif($h < 12) { |
} |
$timest .= "$h am"; |
$timest=&mt($timest); |
} else { |
$result .= $timest." </option>\n"; |
$timest .= $h-12 ." pm"; |
} |
} |
$result .= " </select>\n"; |
$timest=&mt($timest); |
$result .= " <input type=\"text\" name=\"$dname\_minute\" ".$special.' '. |
$result .= $timest." </option>\n"; |
$state.' '. |
} |
"value=\"$min\" size=\"3\" /> m\n"; |
$result .= " </select>\n"; |
$result .= " <input type=\"text\" name=\"$dname\_second\" ".$special.' '. |
$result .= " <input type=\"text\" name=\"$dname\_minute\" ". |
$state.' '. |
$special.' '. |
"value=\"$sec\" size=\"3\" /> s\n"; |
$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()\">". |
$result .= "<a href=\"javascript:$dname\_opencalendar()\">". |
&mt('Select Date')."</a></nobr>\n<!-- end $dname date setting form -->\n"; |
&mt('Select Date')."</a></nobr>\n<!-- end $dname date setting form -->\n"; |
return $result; |
return $result; |
Line 393 sub get_date_from_form {
|
Line 412 sub get_date_from_form {
|
$sec = $tmpsec; |
$sec = $tmpsec; |
} |
} |
if (!defined($tmpsec) || $tmpsec eq '') { $sec = 0; } |
if (!defined($tmpsec) || $tmpsec eq '') { $sec = 0; } |
|
} else { |
|
$sec = 0; |
} |
} |
if (defined($ENV{'form.'.$dname.'_minute'})) { |
if (defined($ENV{'form.'.$dname.'_minute'})) { |
my $tmpmin = $ENV{'form.'.$dname.'_minute'}; |
my $tmpmin = $ENV{'form.'.$dname.'_minute'}; |
Line 400 sub get_date_from_form {
|
Line 421 sub get_date_from_form {
|
$min = $tmpmin; |
$min = $tmpmin; |
} |
} |
if (!defined($tmpmin) || $tmpmin eq '') { $min = 0; } |
if (!defined($tmpmin) || $tmpmin eq '') { $min = 0; } |
|
} else { |
|
$min = 0; |
} |
} |
if (defined($ENV{'form.'.$dname.'_hour'})) { |
if (defined($ENV{'form.'.$dname.'_hour'})) { |
my $tmphour = $ENV{'form.'.$dname.'_hour'}; |
my $tmphour = $ENV{'form.'.$dname.'_hour'}; |
if (($tmphour =~ /^\d+$/) && ($tmphour >= 0) && ($tmphour < 24)) { |
if (($tmphour =~ /^\d+$/) && ($tmphour >= 0) && ($tmphour < 24)) { |
$hour = $tmphour; |
$hour = $tmphour; |
} |
} |
|
} else { |
|
$hour = 0; |
} |
} |
if (defined($ENV{'form.'.$dname.'_day'})) { |
if (defined($ENV{'form.'.$dname.'_day'})) { |
my $tmpday = $ENV{'form.'.$dname.'_day'}; |
my $tmpday = $ENV{'form.'.$dname.'_day'}; |
Line 843 sub crumbs {
|
Line 868 sub crumbs {
|
# ------------------------------------------------- Output headers for HTMLArea |
# ------------------------------------------------- Output headers for HTMLArea |
|
|
sub htmlareaheaders { |
sub htmlareaheaders { |
unless (&htmlareablocked()) { return ''; } |
if (&htmlareablocked()) { return ''; } |
my $lang='en'; |
my $lang='en'; |
|
if (&mt('htmlarea_lang') ne 'htmlarea_lang') { |
|
$lang=&mt('htmlarea_lang'); |
|
} |
return (<<ENDHEADERS); |
return (<<ENDHEADERS); |
<script type="text/javascript"> |
<script type="text/javascript"> |
_editor_url="/htmlarea/"; |
_editor_url="/htmlarea/"; |
</script> |
</script> |
<script type="text/javascript" src="/htmlarea/htmlarea.js"></script> |
<script type="text/javascript" src="/htmlarea/htmlarea.js"></script> |
<script type="text/javascript" src="/htmlarea/lang/$lang.js"></script> |
<style type="text/javascript"> |
<script type="text/javascript" src="/htmlarea/dialog.js"></script> |
_editor_url='/htmlarea/'; |
<style type="text/css"> |
_editor_lang='$lang'; |
\@import url(/htmlarea/htmlarea.css); |
|
</style> |
</style> |
ENDHEADERS |
ENDHEADERS |
} |
} |
Line 861 ENDHEADERS
|
Line 888 ENDHEADERS
|
# ---------------------------------------------------------- Script to activate |
# ---------------------------------------------------------- Script to activate |
|
|
sub htmlareaactive { |
sub htmlareaactive { |
unless (&htmlareablocked()) { return ''; } |
if (&htmlareablocked()) { return ''; } |
return (<<ENDSCRIPT); |
return (<<ENDSCRIPT); |
<script type="text/javascript" defer="1"> |
<script type="text/javascript" defer="1"> |
HTMLArea.replaceAll(); |
HTMLArea.replaceAll(); |
Line 872 ENDSCRIPT
|
Line 899 ENDSCRIPT
|
# --------------------------------------------------------------------- Blocked |
# --------------------------------------------------------------------- Blocked |
|
|
sub htmlareablocked { |
sub htmlareablocked { |
unless (&htmlareabrowser()) { return ''; } |
unless (&htmlareabrowser()) { return 1; } |
return 1; |
return 0; |
} |
} |
|
|
# ---------------------------------------- Browser capable of running HTMLArea? |
# ---------------------------------------- Browser capable of running HTMLArea? |
Line 950 returns: nothing
|
Line 977 returns: nothing
|
# The last breadcrumb does not have a link, so handle it separately. |
# The last breadcrumb does not have a link, so handle it separately. |
my $last = pop(@Crumbs); |
my $last = pop(@Crumbs); |
# |
# |
# The first one should be the course, I guess. |
# The first one should be the course or a menu link |
if (!defined($menulink)) { $menulink=1; } |
if (!defined($menulink)) { $menulink=1; } |
if ($menulink && exists($ENV{'request.course.id'})) { |
if ($menulink) { |
my $cid = $ENV{'request.course.id'}; |
my $description = 'Menu'; |
|
if (exists($ENV{'request.course.id'}) && |
|
$ENV{'request.course.id'} ne '') { |
|
$description = |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; |
|
} |
unshift(@Crumbs,{ |
unshift(@Crumbs,{ |
href=>'/adm/menu', |
href =>'/adm/menu', |
title=>'Go to main menu', |
title =>'Go to main menu', |
text=>$ENV{'course.'.$cid.'.description'}, |
target =>'_top', |
}); |
text =>$description, |
|
}); |
} |
} |
my $links .= |
my $links .= |
join('->', |
join('->', |
map { |
map { |
$faq = $_->{'faq'} if (exists($_->{'faq'})); |
$faq = $_->{'faq'} if (exists($_->{'faq'})); |
$bug = $_->{'bug'} if (exists($_->{'bug'})); |
$bug = $_->{'bug'} if (exists($_->{'bug'})); |
'<a href="'.$_->{'href'}.'" title="'.&mt($_->{'title'}).'">'. |
my $result = '<a href="'.$_->{'href'}.'" '; |
&mt($_->{'text'}).'</a>' |
if (defined($_->{'target'}) && $_->{'target'} ne '') { |
|
$result .= 'target="'.$_->{'target'}.'" '; |
|
} |
|
$result .='title="'.&mt($_->{'title'}).'">'. |
|
&mt($_->{'text'}).'</a>'; |
|
$result; |
} @Crumbs |
} @Crumbs |
); |
); |
$links .= '->' if ($links ne ''); |
$links .= '->' if ($links ne ''); |