--- loncom/interface/lonhtmlcommon.pm 2003/06/19 15:02:37 1.25 +++ loncom/interface/lonhtmlcommon.pm 2004/01/15 20:22:47 1.40 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.25 2003/06/19 15:02:37 matthew Exp $ +# $Id: lonhtmlcommon.pm,v 1.40 2004/01/15 20:22:47 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -56,8 +56,76 @@ html. package Apache::lonhtmlcommon; use Time::Local; +use Apache::lonlocal; use strict; + +############################################## +############################################## + +=pod + +=item authorbombs + +=cut + +############################################## +############################################## + +sub authorbombs { + my $url=shift; + $url=&Apache::lonnet::declutter($url); + my ($udom,$uname)=($url=~/^(\w+)\/(\w+)\//); + 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 ''; +} + +############################################## +############################################## + +=pod + +=item textbox + +=cut + +############################################## +############################################## +sub textbox { + my ($name,$value,$size,$special) = @_; + $size = 40 if (! defined($size)); + my $Str = ''; + return $Str; +} + +############################################## +############################################## + +=pod + +=item checkbox + +=cut + +############################################## +############################################## +sub checkbox { + my ($name,$value) = @_; + my $Str = ''; + return $Str; +} + + + ############################################## ############################################## @@ -85,6 +153,11 @@ The current setting for this time parame An undefined value is taken to indicate the value is the current time. Also, to be explicit, a value of 'now' also indicates the current time. +=item $special + +Additional html/javascript to be associated with each element in +the date_setter. See lonparmset for example usage. + =back Bugs @@ -96,14 +169,21 @@ The method used to restrict user input w ############################################## ############################################## sub date_setter { - my ($formname,$dname,$currentvalue) = @_; + my ($formname,$dname,$currentvalue,$special,$includeempty) = @_; if (! defined($currentvalue) || $currentvalue eq 'now') { - $currentvalue = time; + unless ($includeempty) { + $currentvalue = time; + } else { + $currentvalue = 0; + } } # other potentially useful values: wkday,yrday,is_daylight_savings - my ($sec,$min,$hour,$mday,$month,$year,undef,undef,undef) = - localtime($currentvalue); - $year += 1900; + my ($sec,$min,$hour,$mday,$month,$year)=('','','','','',''); + if ($currentvalue) { + ($sec,$min,$hour,$mday,$month,$year,undef,undef,undef) = + localtime($currentvalue); + $year += 1900; + } my $result = "\n\n"; $result .= < @@ -137,49 +217,64 @@ sub date_setter { document.$formname.$dname\_day.value = 30; } } + + function $dname\_opencalendar() { + var calwin=window.open( +"/adm/announcements?pickdate=yes&formname=$formname&element=$dname&month="+ +document.$formname.$dname\_month.value+"&year="+ +document.$formname.$dname\_year.value, + "LONCAPAcal", + "height=350,width=350,scrollbars=yes,resizable=yes,menubar=no"); + + } ENDJS - $result .= " \n"; $result .= " \n"; $result .= " \n"; $result .= "  "; - $result .= " \n"; + if ($includeempty) { $result.=""; } for (my $h = 0;$h<24;$h++) { $result .= "