--- loncom/interface/lonhtmlcommon.pm 2005/02/17 08:29:42 1.103
+++ loncom/interface/lonhtmlcommon.pm 2006/03/21 18:39:02 1.122
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.103 2005/02/17 08:29:42 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.122 2006/03/21 18:39:02 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -55,10 +55,11 @@ html.
package Apache::lonhtmlcommon;
+use strict;
use Time::Local;
use Time::HiRes;
use Apache::lonlocal;
-use strict;
+use Apache::lonnet;
##############################################
##############################################
@@ -99,7 +100,7 @@ sub store_recent {
my ($area,$name,$value)=@_;
my $file=&recent_filename($area);
my %recent=&Apache::lonnet::dump($file);
- if (scalar(keys(%recent))>10) {
+ if (scalar(keys(%recent))>20) {
# remove oldest value
my $oldest=time;
my $delkey='';
@@ -206,6 +207,28 @@ sub checkbox {
return $Str;
}
+
+=pod
+
+=item radiobutton
+
+=cut
+
+##############################################
+##############################################
+sub radio {
+ my ($name,$checked,$value) = @_;
+ my $Str = '\n";
$result .= <
@@ -435,8 +477,8 @@ sub get_date_from_form {
my ($dname) = @_;
my ($sec,$min,$hour,$day,$month,$year);
#
- if (defined($ENV{'form.'.$dname.'_second'})) {
- my $tmpsec = $ENV{'form.'.$dname.'_second'};
+ if (defined($env{'form.'.$dname.'_second'})) {
+ my $tmpsec = $env{'form.'.$dname.'_second'};
if (($tmpsec =~ /^\d+$/) && ($tmpsec >= 0) && ($tmpsec < 60)) {
$sec = $tmpsec;
}
@@ -444,8 +486,8 @@ sub get_date_from_form {
} else {
$sec = 0;
}
- if (defined($ENV{'form.'.$dname.'_minute'})) {
- my $tmpmin = $ENV{'form.'.$dname.'_minute'};
+ if (defined($env{'form.'.$dname.'_minute'})) {
+ my $tmpmin = $env{'form.'.$dname.'_minute'};
if (($tmpmin =~ /^\d+$/) && ($tmpmin >= 0) && ($tmpmin < 60)) {
$min = $tmpmin;
}
@@ -453,28 +495,28 @@ sub get_date_from_form {
} else {
$min = 0;
}
- if (defined($ENV{'form.'.$dname.'_hour'})) {
- my $tmphour = $ENV{'form.'.$dname.'_hour'};
+ if (defined($env{'form.'.$dname.'_hour'})) {
+ my $tmphour = $env{'form.'.$dname.'_hour'};
if (($tmphour =~ /^\d+$/) && ($tmphour >= 0) && ($tmphour < 24)) {
$hour = $tmphour;
}
} else {
$hour = 0;
}
- if (defined($ENV{'form.'.$dname.'_day'})) {
- my $tmpday = $ENV{'form.'.$dname.'_day'};
+ if (defined($env{'form.'.$dname.'_day'})) {
+ my $tmpday = $env{'form.'.$dname.'_day'};
if (($tmpday =~ /^\d+$/) && ($tmpday > 0) && ($tmpday < 32)) {
$day = $tmpday;
}
}
- if (defined($ENV{'form.'.$dname.'_month'})) {
- my $tmpmonth = $ENV{'form.'.$dname.'_month'};
+ if (defined($env{'form.'.$dname.'_month'})) {
+ my $tmpmonth = $env{'form.'.$dname.'_month'};
if (($tmpmonth =~ /^\d+$/) && ($tmpmonth > 0) && ($tmpmonth < 13)) {
$month = $tmpmonth - 1;
}
}
- if (defined($ENV{'form.'.$dname.'_year'})) {
- my $tmpyear = $ENV{'form.'.$dname.'_year'};
+ if (defined($env{'form.'.$dname.'_year'})) {
+ my $tmpyear = $env{'form.'.$dname.'_year'};
if (($tmpyear =~ /^\d+$/) && ($tmpyear > 1900)) {
$year = $tmpyear - 1900;
}
@@ -505,11 +547,13 @@ parameter setting wizard.
##############################################
sub pjump_javascript_definition {
my $Str = < 1,
+ 'bgcolor' => '#88DDFF',
+ 'js_ready' => 1});
+ my $end_page = &Apache::loncommon::end_page({'js_ready' => 1});
+
#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($r,'");
$prog_state{'formname'}='popremain';
@@ -855,8 +904,8 @@ sub Increment_PrgWin {
$lasttime = '('.$lasttime.' '.&mt('seconds for').' '.$extraInfo.')';
}
#
- my $user_browser = $ENV{'browser.type'} if (exists($ENV{'browser.type'}));
- my $user_os = $ENV{'browser.os'} if (exists($ENV{'browser.os'}));
+ my $user_browser = $env{'browser.type'} if (exists($env{'browser.type'}));
+ my $user_os = $env{'browser.os'} if (exists($env{'browser.os'}));
if (! defined($user_browser) || ! defined($user_os)) {
(undef,$user_browser,undef,undef,undef,$user_os) =
&Apache::loncommon::decode_user_agent();
@@ -907,7 +956,7 @@ sub crumbs {
my $output='';
unless ($noformat) { $output.='
'; }
$output.=''.$prefix.'/';
- if ($ENV{'user.adv'}) {
+ if ($env{'user.adv'}) {
my $path=$prefix.'/';
foreach my $dir (split('/',$uri)) {
if (! $dir) { next; }
@@ -931,13 +980,14 @@ sub crumbs {
sub spellheader {
my $html=&Apache::lonxml::xmlbegin();
+ my $nothing=&javascript_nothing();
return (<
//