--- loncom/interface/lonhtmlcommon.pm 2004/04/12 20:03:31 1.64 +++ loncom/interface/lonhtmlcommon.pm 2004/06/03 14:28:39 1.72 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.64 2004/04/12 20:03:31 albertel Exp $ +# $Id: lonhtmlcommon.pm,v 1.72 2004/06/03 14:28:39 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -163,9 +163,15 @@ sub textbox { ############################################## ############################################## sub checkbox { - my ($name,$value) = @_; - my $Str = ''; + my ($name,$checked,$value) = @_; + my $Str = '\n"; + # Month my @Months = qw/January February March April May June July August September October November December/; # Pad @Months with a bogus value to make indexing easier @@ -316,39 +327,47 @@ ENDJS $result .= "> ".&mt($Months[$m])." \n"; } $result .= " \n"; + # Day $result .= " \n"; + # Year $result .= " \n"; $result .= "  "; - $result .= " \n"; - $result .= " m\n"; - $result .= " s\n"; + if (! $no_hh_mm_ss) { + # Hours + $result .= " \n"; + $result .= " m\n"; + $result .= " s\n"; + } $result .= "". &mt('Select Date')."\n\n"; return $result; @@ -393,6 +412,8 @@ sub get_date_from_form { $sec = $tmpsec; } if (!defined($tmpsec) || $tmpsec eq '') { $sec = 0; } + } else { + $sec = 0; } if (defined($ENV{'form.'.$dname.'_minute'})) { my $tmpmin = $ENV{'form.'.$dname.'_minute'}; @@ -400,12 +421,16 @@ sub get_date_from_form { $min = $tmpmin; } if (!defined($tmpmin) || $tmpmin eq '') { $min = 0; } + } else { + $min = 0; } 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'}; @@ -843,17 +868,19 @@ sub crumbs { # ------------------------------------------------- Output headers for HTMLArea sub htmlareaheaders { - unless (&htmlareablocked()) { return ''; } + if (&htmlareablocked()) { return ''; } my $lang='en'; + if (&mt('htmlarea_lang') ne 'htmlarea_lang') { + $lang=&mt('htmlarea_lang'); + } return (< _editor_url="/htmlarea/"; - - - ENDHEADERS } @@ -861,7 +888,7 @@ ENDHEADERS # ---------------------------------------------------------- Script to activate sub htmlareaactive { - unless (&htmlareablocked()) { return ''; } + if (&htmlareablocked()) { return ''; } return (< HTMLArea.replaceAll(); @@ -869,11 +896,23 @@ sub htmlareaactive { ENDSCRIPT } +# ----------------------------------------- Script to activate only some fields + +sub htmlareaselectactive { + if (&htmlareablocked()) { return ''; } + my $output='"; + return $output; +} + # --------------------------------------------------------------------- Blocked sub htmlareablocked { - unless (&htmlareabrowser()) { return ''; } - return 1; + unless (&htmlareabrowser()) { return 1; } + return 0; } # ---------------------------------------- Browser capable of running HTMLArea? @@ -950,23 +989,34 @@ returns: nothing # The last breadcrumb does not have a link, so handle it separately. 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 ($menulink && exists($ENV{'request.course.id'})) { - my $cid = $ENV{'request.course.id'}; + if ($menulink) { + my $description = 'Menu'; + if (exists($ENV{'request.course.id'}) && + $ENV{'request.course.id'} ne '') { + $description = + $ENV{'course.'.$ENV{'request.course.id'}.'.description'}; + } unshift(@Crumbs,{ - href=>'/adm/menu', - title=>'Go to main menu', - text=>$ENV{'course.'.$cid.'.description'}, - }); + href =>'/adm/menu', + title =>'Go to main menu', + target =>'_top', + text =>$description, + }); } my $links .= join('->', map { $faq = $_->{'faq'} if (exists($_->{'faq'})); $bug = $_->{'bug'} if (exists($_->{'bug'})); - ''. - &mt($_->{'text'}).'' + my $result = '{'target'}) && $_->{'target'} ne '') { + $result .= 'target="'.$_->{'target'}.'" '; + } + $result .='title="'.&mt($_->{'title'}).'">'. + &mt($_->{'text'}).''; + $result; } @Crumbs ); $links .= '->' if ($links ne '');