--- loncom/interface/lonsupportreq.pm 2004/12/31 02:46:18 1.21 +++ loncom/interface/lonsupportreq.pm 2005/04/10 23:45:57 1.27 @@ -1,12 +1,39 @@ +# +# $Id: lonsupportreq.pm,v 1.27 2005/04/10 23:45:57 raeburn Exp $ +# +# Copyright Michigan State University Board of Trustees +# +# This file is part of the LearningOnline Network with CAPA (LON-CAPA). +# +# LON-CAPA is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LON-CAPA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LON-CAPA; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# /home/httpd/html/adm/gpl.txt +# +# http://www.lon-capa.org/ +# + package Apache::lonsupportreq; use strict; use lib qw(/home/httpd/lib/perl); use MIME::Types; use MIME::Lite; +use CGI::Cookie(); use Apache::Constants qw(:common); use Apache::loncommon(); -use Apache::lonnet(); +use Apache::lonnet; use Apache::lonlocal; sub handler { @@ -21,9 +48,9 @@ sub handler { if ($r->uri eq '/adm/helpdesk') { &Apache::loncommon::get_posted_cgi($r); } - my $function = $ENV{'form.function'}; - my $origurl = &Apache::lonnet::unescape($ENV{'form.origurl'}); - my $action = $ENV{'form.action'}; + my $function = $env{'form.function'}; + my $origurl = &Apache::lonnet::unescape($env{'form.origurl'}); + my $action = $env{'form.action'}; if ($action eq 'process') { &print_request_receipt($r,$origurl,$function); @@ -36,22 +63,22 @@ sub handler { sub print_request_form { my ($r,$origurl,$function) = @_; my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid,$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server); - my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0",marginheight="0"',1); + my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0" marginheight="0" onLoad="initialize_codes()"',1); my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg'); if (($tablecolor eq '') || ($tablecolor eq '#FFFFFF')) { $tablecolor = '#EEEE99'; } $ccode = ''; - $os = $ENV{'browser.os'}; - $browser = $ENV{'browser.type'}; - $bversion = $ENV{'browser.version'}; - $uhost = $ENV{'request.host'}; - $uname = $ENV{'user.name'}; - $udom = $ENV{'user.domain'}; - $uhome = $ENV{'user.home'}; - $urole = $ENV{'request.role'}; - $usec = $ENV{'request.course.sec'}; - $cid = $ENV{'request.course.id'}; + $os = $env{'browser.os'}; + $browser = $env{'browser.type'}; + $bversion = $env{'browser.version'}; + $uhost = $env{'request.host'}; + $uname = $env{'user.name'}; + $udom = $env{'user.domain'}; + $uhome = $env{'user.home'}; + $urole = $env{'request.role'}; + $usec = $env{'request.course.sec'}; + $cid = $env{'request.course.id'}; if ($origurl =~ m-^http://-) { $server = $origurl; } else { @@ -87,6 +114,7 @@ function validmail(field) { } } END + #" stupid emacs if ($cid =~ m/_/) { ($cdom,$cnum) = split/_/,$cid; } @@ -96,17 +124,17 @@ END $ccode = $csettings{'internal.coursecode'}; $sectionlist = $csettings{'internal.sectionnums'}; } - if ($ENV{'environment.critnotification'}) { - $email = $ENV{'environment.critnotification'}; + if ($env{'environment.critnotification'}) { + $email = $env{'environment.critnotification'}; } - if (!$email && $ENV{'environment.notification'}) { - $email = $ENV{'environment.notification'}; + if (!$email && $env{'environment.notification'}) { + $email = $env{'environment.notification'}; } - if ($ENV{'environment.lastname'}) { - $lastname = $ENV{'environment.lastname'}; + if ($env{'environment.lastname'}) { + $lastname = $env{'environment.lastname'}; } - if ($ENV{'environment.firstname'}) { - $firstname = $ENV{'environment.firstname'}; + if ($env{'environment.firstname'}) { + $firstname = $env{'environment.firstname'}; } my @sections = split/,/,$sectionlist; my %groupid = (); @@ -116,8 +144,8 @@ END } my $codedom = $Apache::lonnet::perlvar{'lonDefDomain'}; &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom']); - if (exists($ENV{'form.codedom'})) { - $codedom = $ENV{'form.codedom'}; + if (exists($env{'form.codedom'})) { + $codedom = $env{'form.codedom'}; } my $details_title; if ($codedom) { @@ -135,7 +163,11 @@ END my $totcodes = 0; my $format_reply; my $jscript = ''; - + my $loaditems = qq| +function initialize_codes() { + return; +} + |; if ($cdom) { $codedom = $cdom; } @@ -152,15 +184,19 @@ END $totcodes = &retrieve_instcodes(\%coursecodes,$codedom,$totcodes); } if ($totcodes > 0) { - $format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order); if ($ccode eq '') { - my $numtypes = @codetitles; - &build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles); - &javascript_code_selections($numtypes,\%cat_titles,\$jscript,\%idlist,\%idnums,\%idlist_titles,\@codetitles); + $format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order); + if ($format_reply eq 'ok') { + my $numtypes = @codetitles; + &build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles); + &javascript_code_selections($numtypes,\%cat_titles,\$jscript,\%idlist,\%idnums,\%idlist_titles,\@codetitles); + $loaditems = ''; + } } } + my $html=&Apache::lonxml::xmlbegin(); $r->print(< +$html LON-CAPA support request