--- loncom/interface/loncommon.pm 2008/07/08 00:49:18 1.666 +++ loncom/interface/loncommon.pm 2009/10/28 17:24:32 1.692.2.13 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.666 2008/07/08 00:49:18 raeburn Exp $ +# $Id: loncommon.pm,v 1.692.2.13 2009/10/28 17:24:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -61,6 +61,7 @@ use POSIX qw(strftime mktime); use Apache::lonmenu(); use Apache::lonenc(); use Apache::lonlocal; +use Apache::lonnet(); use HTML::Entities; use Apache::lonhtmlcommon(); use Apache::loncoursedata(); @@ -68,6 +69,7 @@ use Apache::lontexconvert(); use Apache::lonclonecourse(); use LONCAPA qw(:DEFAULT :match); use DateTime::TimeZone; +use DateTime::Locale::Catalog; # ---------------------------------------------- Designs use vars qw(%defaultdesign); @@ -657,6 +659,57 @@ sub select_timezone { return $output; } +sub select_datelocale { + my ($name,$selected,$onchange,$includeempty)=@_; + my $output=' form to allow a user to select the domain to preform an operation in. @@ -1691,16 +1755,21 @@ See loncreateuser.pm for an example invo If the $includeempty flag is set, it also includes an empty choice ("no domain selected"); -If the $showdomdesc flag is set, the domain name is followed by the domain description. +If the $showdomdesc flag is set, the domain name is followed by the domain description. + +The optional $onchange argument specifies what should occur if the domain selector is changed, e.g., 'this.form.submit()' if the form is to be automatically submitted. =cut #------------------------------------------- sub select_dom_form { - my ($defdom,$name,$includeempty,$showdomdesc) = @_; + my ($defdom,$name,$includeempty,$showdomdesc,$onchange) = @_; + if ($onchange) { + $onchange = ' onchange="'.$onchange.'"'; + } my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains()); if ($includeempty) { @domains=('',@domains); } - my $selectdomain = "\n"; foreach my $dom (@domains) { $selectdomain.="