--- loncom/interface/lonsupportreq.pm 2004/12/30 21:16:38 1.20
+++ loncom/interface/lonsupportreq.pm 2005/10/13 17:18:14 1.29
@@ -1,12 +1,39 @@
+#
+# $Id: lonsupportreq.pm,v 1.29 2005/10/13 17:18:14 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);
@@ -35,24 +62,29 @@ 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 ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid,$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server,$formname);
+ 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'};
- $server = $ENV{'SERVER_NAME'};
+ $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'};
+ $formname = 'logproblem';
+ if ($origurl =~ m-^http://-) {
+ $server = $origurl;
+ } else {
+ $server = 'http://'.$ENV{'SERVER_NAME'}.$origurl;
+ }
my $scripttag = (<<'END');
function validate() {
if (validmail(document.logproblem.email) == false) {
@@ -83,6 +115,7 @@ function validmail(field) {
}
}
END
+ #" stupid emacs
if ($cid =~ m/_/) {
($cdom,$cnum) = split/_/,$cid;
}
@@ -92,17 +125,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 = ();
@@ -112,8 +145,12 @@ 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) {
+ $details_title = '
('.$codedom.')';
}
my %coursecodes = ();
my %codes = ();
@@ -127,7 +164,11 @@ END
my $totcodes = 0;
my $format_reply;
my $jscript = '';
-
+ my $loaditems = qq|
+function initialize_codes() {
+ return;
+}
+ |;
if ($cdom) {
$codedom = $cdom;
}
@@ -144,15 +185,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($formname,$numtypes,\%cat_titles,\$jscript,\%idlist,\%idnums,\%idlist_titles,\@codetitles);
+ $loaditems = '';
+ }
}
}
+ my $html=&Apache::lonxml::xmlbegin();
$r->print(<
+$html
LON-CAPA support request