--- loncom/interface/lonhtmlcommon.pm 2002/08/30 15:35:08 1.9 +++ loncom/interface/lonhtmlcommon.pm 2007/01/05 17:55:41 1.156 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.9 2002/08/30 15:35:08 stredwic Exp $ +# $Id: lonhtmlcommon.pm,v 1.156 2007/01/05 17:55:41 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -25,370 +25,1821 @@ # # http://www.lon-capa.org/ # +###################################################################### +###################################################################### + +=pod + +=head1 NAME + +Apache::lonhtmlcommon - routines to do common html things + +=head1 SYNOPSIS + +Referenced by other mod_perl Apache modules. + +=head1 INTRODUCTION + +lonhtmlcommon is a collection of subroutines used to present information +in a consistent html format, or provide other functionality related to +html. + +=head2 General Subroutines + +=over 4 + +=cut + +###################################################################### +###################################################################### package Apache::lonhtmlcommon; use strict; +use Time::Local; +use Time::HiRes; +use Apache::lonlocal; +use Apache::lonnet; +use LONCAPA; + +############################################## +############################################## -sub AscendOrderOptions { - my ($order, $page, $formName)=@_; +=pod - my $OpSel1 = ''; - my $OpSel2 = ''; +=item authorbombs - if($order eq 'Ascending') { - $OpSel1 = ' selected'; - } else { - $OpSel2 = ' selected'; +=cut + +############################################## +############################################## + +sub authorbombs { + my $url=shift; + $url=&Apache::lonnet::declutter($url); + my ($udom,$uname)=($url=~m{^($LONCAPA::domain_re)/($LONCAPA::username_re)/}); + my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom); + foreach (keys %bombs) { + if ($_=~/^$udom\/$uname\//) { + return ''. + &Apache::loncommon::help_open_topic('About_Bombs'); + } } + return ''; +} - my $Str = ''; - $Str .= ''."\n"; +# store new value + my $timestamp; + if ($freeze) { + $timestamp = "always_include"; + } else { + $timestamp = time(); + } + &Apache::lonnet::put($file,{ $name => + $timestamp.'&'.&escape($value) }); +} - return $Str; +sub remove_recent { + my ($area,$names)=@_; + my $file=&recent_filename($area); + return &Apache::lonnet::del($file,$names); } -sub MapOptions { - my ($data, $page, $formName)=@_; - my $Str = ''; - $Str .= '\n"; + return $return; +} - my $selected = 0; - foreach my $sequence (split(':',$data->{'orderedSequences'})) { - $Str .= '{$page.'Maps'} eq $data->{$sequence.':title'}) { - $Str .= ' selected'; - $selected = 1; - } - $Str .= '>'.$data->{$sequence.':title'}.''."\n"; - } - $Str .= '= $n)) {last;} + } - return $Str; + return %return_hash; } -sub ProblemOptions { - my ($data, $page, $map, $formName)=@_; - my $Str = ''; - $Str .= ''; return $Str; } -sub PartOptions { - my ($data, $page, $parts, $formName)=@_; - my $Str = ''; +############################################## +############################################## - if(!defined($parts)) { - return ''; - } +=pod - $Str .= '}; + # 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 + unshift(@Months,'If you can read this an error occurred'); + if ($includeempty) { $monthselector.=""; } + for(my $m = 1;$m <=$#Months;$m++) { + $monthselector .= qq{