version 1.13, 2004/12/18 22:30:28
|
version 1.37, 2006/09/01 21:07:11
|
Line 1
|
Line 1
|
|
# |
|
# $Id$ |
|
# |
|
# 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; |
package Apache::lonsupportreq; |
|
|
use strict; |
use strict; |
use lib qw(/home/httpd/lib/perl); |
use lib qw(/home/httpd/lib/perl); |
use MIME::Types; |
use MIME::Types; |
use MIME::Lite; |
use MIME::Lite; |
|
use CGI::Cookie(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonnet(); |
use Apache::lonnet; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonacc(); |
|
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
|
|
|
sub handler { |
sub handler { |
my ($r) = @_; |
my ($r) = @_; |
Line 19 sub handler {
|
Line 50 sub handler {
|
} |
} |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['origurl','function']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['origurl','function']); |
if ($r->uri eq '/adm/helpdesk') { |
if ($r->uri eq '/adm/helpdesk') { |
&Apache::loncommon::get_posted_cgi($r); |
&Apache::lonacc::get_posted_cgi($r); |
} |
} |
my $function = $ENV{'form.function'}; |
my $function = $env{'form.function'}; |
my $origurl = &Apache::lonnet::unescape($ENV{'form.origurl'}); |
my $origurl = &unescape($env{'form.origurl'}); |
my $action = $ENV{'form.action'}; |
my $action = $env{'form.action'}; |
|
|
if ($action eq 'process') { |
if ($action eq 'process') { |
&print_request_receipt($r,$origurl,$function); |
&print_request_receipt($r,$origurl,$function); |
Line 35 sub handler {
|
Line 66 sub handler {
|
|
|
sub print_request_form { |
sub print_request_form { |
my ($r,$origurl,$function) = @_; |
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 ($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"',1); |
|
my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg'); |
my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg'); |
if (($tablecolor eq '') || ($tablecolor eq '#FFFFFF')) { |
if (($tablecolor eq '') || ($tablecolor eq '#FFFFFF')) { |
$tablecolor = '#CCCCFF'; |
$tablecolor = '#EEEE99'; |
} |
} |
$ccode = ''; |
$ccode = ''; |
$os = $ENV{'browser.os'}; |
$os = $env{'browser.os'}; |
$browser = $ENV{'browser.type'}; |
$browser = $env{'browser.type'}; |
$bversion = $ENV{'browser.version'}; |
$bversion = $env{'browser.version'}; |
$uhost = $ENV{'request.host'}; |
$uhost = $env{'request.host'}; |
$uname = $ENV{'user.name'}; |
$uname = $env{'user.name'}; |
$udom = $ENV{'user.domain'}; |
$udom = $env{'user.domain'}; |
$uhome = $ENV{'user.home'}; |
$uhome = $env{'user.home'}; |
$urole = $ENV{'request.role'}; |
$urole = $env{'request.role'}; |
$usec = $ENV{'request.course.sec'}; |
$usec = $env{'request.course.sec'}; |
$cid = $ENV{'request.course.id'}; |
$cid = $env{'request.course.id'}; |
$server = $ENV{'SERVER_NAME'}; |
$formname = 'logproblem'; |
|
if ($origurl =~ m-^http://-) { |
|
$server = $origurl; |
|
} else { |
|
$server = 'http://'.$ENV{'SERVER_NAME'}.$origurl; |
|
} |
my $scripttag = (<<'END'); |
my $scripttag = (<<'END'); |
function validate() { |
function validate() { |
if (validmail(document.logproblem.email) == false) { |
if (validmail(document.logproblem.email) == false) { |
Line 66 function validmail(field) {
|
Line 101 function validmail(field) {
|
var str = field.value; |
var str = field.value; |
if (window.RegExp) { |
if (window.RegExp) { |
var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)"; |
var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)"; |
var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$"; |
var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$"; //" |
var reg1 = new RegExp(reg1str); |
var reg1 = new RegExp(reg1str); |
var reg2 = new RegExp(reg2str); |
var reg2 = new RegExp(reg2str); |
if (!reg1.test(str) && reg2.test(str)) { |
if (!reg1.test(str) && reg2.test(str)) { |
Line 83 function validmail(field) {
|
Line 118 function validmail(field) {
|
} |
} |
} |
} |
END |
END |
|
|
if ($cid =~ m/_/) { |
if ($cid =~ m/_/) { |
($cdom,$cnum) = split/_/,$cid; |
($cdom,$cnum) = split/_/,$cid; |
} |
} |
Line 92 END
|
Line 128 END
|
$ccode = $csettings{'internal.coursecode'}; |
$ccode = $csettings{'internal.coursecode'}; |
$sectionlist = $csettings{'internal.sectionnums'}; |
$sectionlist = $csettings{'internal.sectionnums'}; |
} |
} |
if ($ENV{'environment.critnotification'}) { |
if ($env{'environment.critnotification'}) { |
$email = $ENV{'environment.critnotification'}; |
$email = $env{'environment.critnotification'}; |
} |
} |
if (!$email && $ENV{'environment.notification'}) { |
if (!$email && $env{'environment.notification'}) { |
$email = $ENV{'environment.notification'}; |
$email = $env{'environment.notification'}; |
} |
} |
if ($ENV{'environment.lastname'}) { |
if ($env{'environment.lastname'}) { |
$lastname = $ENV{'environment.lastname'}; |
$lastname = $env{'environment.lastname'}; |
} |
} |
if ($ENV{'environment.firstname'}) { |
if ($env{'environment.firstname'}) { |
$firstname = $ENV{'environment.firstname'}; |
$firstname = $env{'environment.firstname'}; |
} |
} |
my @sections = split/,/,$sectionlist; |
my @sections = split/,/,$sectionlist; |
my %groupid = (); |
my %groupid = (); |
Line 110 END
|
Line 146 END
|
my ($sec,$grp) = split/:/,$_; |
my ($sec,$grp) = split/:/,$_; |
$groupid{$sec} = $grp; |
$groupid{$sec} = $grp; |
} |
} |
my $defdom = $Apache::lonnet::perlvar{'lonDefDomain'}; |
my $codedom = $Apache::lonnet::perlvar{'lonDefDomain'}; |
my $codedom = $defdom; |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom']); |
|
if (exists($env{'form.codedom'})) { |
|
$codedom = $env{'form.codedom'}; |
|
} |
|
my $details_title; |
|
if ($codedom) { |
|
$details_title = '<br />('.$codedom.')'; |
|
} |
my %coursecodes = (); |
my %coursecodes = (); |
my %codes = (); |
my %codes = (); |
my @codetitles = (); |
my @codetitles = (); |
Line 124 END
|
Line 167 END
|
my $totcodes = 0; |
my $totcodes = 0; |
my $format_reply; |
my $format_reply; |
my $jscript = ''; |
my $jscript = ''; |
|
my $loaditems = qq| |
|
function initialize_codes() { |
|
return; |
|
} |
|
|; |
if ($cdom) { |
if ($cdom) { |
$codedom = $cdom; |
$codedom = $cdom; |
} |
} |
Line 141 END
|
Line 188 END
|
$totcodes = &retrieve_instcodes(\%coursecodes,$codedom,$totcodes); |
$totcodes = &retrieve_instcodes(\%coursecodes,$codedom,$totcodes); |
} |
} |
if ($totcodes > 0) { |
if ($totcodes > 0) { |
$format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order); |
|
if ($ccode eq '') { |
if ($ccode eq '') { |
my $numtypes = @codetitles; |
$format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order); |
&build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles); |
if ($format_reply eq 'ok') { |
&javascript_code_selections($numtypes,\$jscript,\%idlist,\%idnums,\%idlist_titles,\@codetitles); |
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 = ''; |
|
} |
} |
} |
} |
} |
$r->print(<<END); |
|
<html> |
my $js = '<script type"text/javascript">'."\n$scripttag\n$jscript\n". |
<head> |
'</script>'; |
<title>LON-CAPA support request</title> |
my %add_entries = (topmargin => "0", |
<script> |
marginheight => "0", |
$scripttag |
onLoad =>"initialize_codes()",); |
$jscript |
|
</script> |
my $start_page = |
</head> |
&Apache::loncommon::start_page('Support Request',$js, |
$bodytag |
{ 'function' => $function, |
|
'add_entries' => \%add_entries, |
|
'only_body' => 1,}); |
|
$r->print($start_page); |
|
|
|
if ($r->uri eq '/adm/helpdesk') { |
|
&print_header($r,$origurl); |
|
} |
|
$r->print(<<"END"); |
|
<form method="post" name="logproblem" enctype="multipart/form-data"> |
<table width="580" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000"> |
<table width="580" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000"> |
<tr> |
<tr> |
<td> |
<td> |
Line 168 $bodytag
|
Line 227 $bodytag
|
<tr> |
<tr> |
<td> |
<td> |
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff"> |
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff"> |
<form method="post" name="logproblem" enctype="multipart/form-data"> |
|
<tr> |
<tr> |
<td width="140" bgcolor="$tablecolor"> |
<td width="140" bgcolor="$tablecolor"> |
<table width="140" border="0" cellpadding="8" cellspacing="0"> |
<table width="140" border="0" cellpadding="8" cellspacing="0"> |
Line 193 END
|
Line 251 END
|
} elsif (defined($lastname) && $lastname ne '') { |
} elsif (defined($lastname) && $lastname ne '') { |
$fullname= " $lastname"; |
$fullname= " $lastname"; |
} |
} |
$r->print('<input type="text" size="20" name="username" value="'.$fullname.'" /><br />'); |
$r->print('<input type="text" size="20" name="username" value="'.$fullname.'" />'); |
} |
} |
$r->print(<<END); |
$r->print(<<END); |
|
<input type="button" value="Submit Request" onClick="validate()" /> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 258 END
|
Line 317 END
|
} |
} |
if ($udomform eq '') { |
if ($udomform eq '') { |
$udomform = '<i>domain</i>: '; |
$udomform = '<i>domain</i>: '; |
$udomform .= &Apache::loncommon::select_dom_form('','udom'); |
$udomform .= &Apache::loncommon::select_dom_form($codedom,'udom'); |
} |
} |
if ($unameform eq '') { |
if ($unameform eq '') { |
$unameform= '<i>username</i>: <input type="text" size="20" name="loncname" value="'.$uname.'" /> '; |
$unameform= '<i>username</i>: <input type="text" size="12" name="uname" value="'.$uname.'" /> '; |
} |
} |
$r->print($unameform.$udomform.'<br />Enter the username you use to log-in to your LON-CAPA system, and choose your domain.'); |
$r->print($unameform.$udomform.'<br />Enter the username you use to log-in to your LON-CAPA system, and choose your domain.'); |
} |
} |
Line 289 END
|
Line 348 END
|
<table width="100%" border="0" cellpadding="8" cellspacing="0"> |
<table width="100%" border="0" cellpadding="8" cellspacing="0"> |
<tr> |
<tr> |
<td> |
<td> |
http://$server$origurl<input type="hidden" name="origurl" value="http://$server$origurl" /> |
$server<input type="hidden" name="sourceurl" value="$server" /> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 328 END
|
Line 387 END
|
<td width="140" bgcolor="$tablecolor"> |
<td width="140" bgcolor="$tablecolor"> |
<table width="140" border="0" cellpadding="8" cellspacing="0"> |
<table width="140" border="0" cellpadding="8" cellspacing="0"> |
<tr> |
<tr> |
<td align="right"><b>Course Details:</b> |
<td align="right"><b>Course Details:</b>$details_title |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 363 END
|
Line 422 END
|
'<select name="'.$codetitles[0].'" onChange="courseSet('."'$codetitles[0]'".')">'."\n". |
'<select name="'.$codetitles[0].'" onChange="courseSet('."'$codetitles[0]'".')">'."\n". |
' <option value="-1" />Select'."\n"); |
' <option value="-1" />Select'."\n"); |
my @items = (); |
my @items = (); |
|
my @longitems = (); |
if ($idlist{$codetitles[0]} =~ /","/) { |
if ($idlist{$codetitles[0]} =~ /","/) { |
@items = split/","/,$idlist{$codetitles[0]}; |
@items = split/","/,$idlist{$codetitles[0]}; |
} else { |
} else { |
$items[0] = $idlist{$codetitles[0]}; |
$items[0] = $idlist{$codetitles[0]}; |
} |
} |
foreach (@items) { |
if (defined($idlist_titles{$codetitles[0]})) { |
$r->print(' <option value="'.$_.'" />'.$_); |
if ($idlist_titles{$codetitles[0]} =~ /","/) { |
|
@longitems = split/","/,$idlist_titles{$codetitles[0]}; |
|
} else { |
|
$longitems[0] = $idlist_titles{$codetitles[0]}; |
|
} |
|
for (my $i=0; $i<@longitems; $i++) { |
|
if ($longitems[$i] eq '') { |
|
$longitems[$i] = $items[$i]; |
|
} |
|
} |
|
} else { |
|
@longitems = @items; |
|
} |
|
for (my $i=0; $i<@items; $i++) { |
|
$r->print(' <option value="'.$items[$i].'">'.$longitems[$i].'</option>'); |
} |
} |
$r->print('</select></td>'); |
$r->print('</select></td>'); |
for (my $i=1; $i<$numtitles; $i++) { |
for (my $i=1; $i<$numtitles; $i++) { |
Line 425 END
|
Line 499 END
|
<td> |
<td> |
END |
END |
if ($sectionlist) { |
if ($sectionlist) { |
$r->print("<select name=\"section\">"); |
$r->print("<select name=\"section\"\n>". |
|
" <option value=\"\" selected=\"selected\">Select</option>\n"); |
foreach (sort keys %groupid) { |
foreach (sort keys %groupid) { |
if ($_ eq $groupid{$_} || $groupid{$_} eq '') { |
if ($_ eq $groupid{$_} || $groupid{$_} eq '') { |
$r->print("<option value=\"$_\" />$_"); |
$r->print(" <option value=\"$_\" >$_</option>\n"); |
} else { |
} else { |
$r->print("<option value=\"$_\" />$_ - (LON-CAPA sec: $groupid{$_})"); |
$r->print(" <option value=\"$_\" >$_ - (LON-CAPA sec: $groupid{$_})</option>\n"); |
} |
} |
} |
} |
$r->print("</select>"); |
$r->print("</select>"); |
Line 497 END
|
Line 572 END
|
</td> |
</td> |
</tr> |
</tr> |
END |
END |
if (defined($ENV{'user.name'})) { |
if (defined($env{'user.name'})) { |
$r->print(<<END); |
$r->print(<<END); |
<tr> |
<tr> |
<td width="140" bgcolor="$tablecolor"> |
<td width="140" bgcolor="$tablecolor"> |
Line 525 END
|
Line 600 END
|
</tr> |
</tr> |
END |
END |
} |
} |
|
|
$r->print(<<END); |
$r->print(<<END); |
<tr> |
<tr> |
<td width="140" bgcolor="$tablecolor"> |
<td width="140" bgcolor="$tablecolor"> |
Line 540 END
|
Line 616 END
|
<tr> |
<tr> |
<td> |
<td> |
<input type="hidden" name="action" value="process" /> |
<input type="hidden" name="action" value="process" /> |
<input type="button" value="Submit Request Form" onClick="validate()"/> |
<input type="button" value="Submit Request" onClick="validate()"/> |
</td> |
</td> |
<td> </td> |
<td> </td> |
<td> |
<td> |
Line 560 END
|
Line 636 END
|
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
|
</form> |
END |
END |
|
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
sub print_request_receipt { |
sub print_request_receipt { |
my ($r,$url,$function) = @_; |
my ($r,$url,$function) = @_; |
my @envvars = ('lonID','HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME','browser.os','browser.type','browser.version','user.home','request.role'); |
my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME'); |
|
my @envvars = ('browser.os','browser.type','browser.version','user.home','request.role'); |
my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id'); |
my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id'); |
|
my @cookievars = ('lonID'); |
|
|
my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0" marginheight="0"',1); |
|
my $admin = $Apache::lonnet::perlvar{'lonAdminMail'}; |
my $admin = $Apache::lonnet::perlvar{'lonAdminMail'}; |
my $to = $Apache::lonnet::perlvar{'lonSupportEMail'}; |
my $to = $Apache::lonnet::perlvar{'lonSupportEMail'}; |
my $from = $admin; |
my $from = $admin; |
Line 577 sub print_request_receipt {
|
Line 656 sub print_request_receipt {
|
my $fontcolor = &Apache::loncommon::designparm($function.'.font'); |
my $fontcolor = &Apache::loncommon::designparm($function.'.font'); |
my $vlinkcolor = &Apache::loncommon::designparm($function.'.vlink'); |
my $vlinkcolor = &Apache::loncommon::designparm($function.'.vlink'); |
my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg'); |
my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg'); |
my @formvars = ('username','email','uname','udom','origurl','phone','section','coursecode','title','subject','description','screenshot'); |
my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot'); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars); |
|
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars); |
|
my $coursecode = $env{'form.coursecode'}; |
|
if ($coursecode eq '') { |
|
if (defined($env{'form.Year'})) { |
|
$coursecode .= $env{'form.Year'}; |
|
} |
|
if (defined($env{'form.Semester'})) { |
|
$coursecode .= $env{'form.Semester'}; |
|
} |
|
if (defined($env{'form.Department'})) { |
|
$coursecode .= $env{'form.Department'}; |
|
} |
|
if (defined($env{'form.Number'})) { |
|
$coursecode .= $env{'form.Number'}; |
|
} |
|
} |
my $supportmsg = qq| |
my $supportmsg = qq| |
Name: $ENV{'form.username'} |
Name: $env{'form.username'} |
Email: $ENV{'form.email'} |
Email: $env{'form.email'} |
Username/domain: $ENV{'form.uname'} - $ENV{'form.udom'} |
Username/domain: $env{'form.uname'} - $env{'form.udom'} |
Tel: $ENV{'form.phone'} |
Tel: $env{'form.phone'} |
Course Information: $ENV{'form.title'} - $ENV{'form.coursecode'} - section: $ENV{'form.section'} |
Course Information: $env{'form.title'} - $coursecode - section: $env{'form.section'} |
Subject: $ENV{'form.subject'} |
Subject: $env{'form.subject'} |
Description: $ENV{'form.description'} |
Description: $env{'form.description'} |
URL: $ENV{'form.origurl'} |
URL: $env{'form.sourceurl'} |
Date/Time: $reporttime |
Date/Time: $reporttime |
|
|
|; |
|; |
my $descrip = $ENV{'form.description'}; |
my $descrip = $env{'form.description'}; |
$descrip =~ s#\n#<br />#g; |
$descrip =~ s#\n#<br />#g; |
my $displaymsg = qq| |
my $displaymsg = qq| |
<font color="$fontcolor">Name:</font><font color="$vlinkcolor"> $ENV{'form.username'}</font><br /> |
<font color="$fontcolor">Name:</font><font color="$vlinkcolor"> $env{'form.username'}</font><br /> |
<font color="$fontcolor">Email: </font><font color="$vlinkcolor">$ENV{'form.email'}</font><br /> |
<font color="$fontcolor">Email: </font><font color="$vlinkcolor">$env{'form.email'}</font><br /> |
<font color="$fontcolor">Username/domain: </font><font color="$vlinkcolor">$ENV{'form.uname'} - $ENV{'form.udom'}</font><br /> |
<font color="$fontcolor">Username/domain: </font><font color="$vlinkcolor">$env{'form.uname'} - $env{'form.udom'}</font><br /> |
<font color="$fontcolor">Tel: </font><font color="$vlinkcolor">$ENV{'form.phone'}</font><br /> |
<font color="$fontcolor">Tel: </font><font color="$vlinkcolor">$env{'form.phone'}</font><br /> |
<font color="$fontcolor">Course Information: </font><font color="$vlinkcolor">$ENV{'form.title'} - $ENV{'form.coursecode'} - section: $ENV{'form.section'}</font><br /> |
<font color="$fontcolor">Course Information: </font><font color="$vlinkcolor">$env{'form.title'} - $coursecode - section: $env{'form.section'}</font><br /> |
<font color="$fontcolor">Subject: </font><font color="$vlinkcolor">$ENV{'form.subject'}</font><br /> |
<font color="$fontcolor">Subject: </font><font color="$vlinkcolor">$env{'form.subject'}</font><br /> |
<font color="$fontcolor">Description: </font><font color="$vlinkcolor">$descrip</font><br /> |
<font color="$fontcolor">Description: </font><font color="$vlinkcolor">$descrip</font><br /> |
<font color="$fontcolor">URL: </font><font color="$vlinkcolor">$ENV{'form.origurl'}</font><br /> |
<font color="$fontcolor">URL: </font><font color="$vlinkcolor">$env{'form.sourceurl'}</font><br /> |
<font color="$fontcolor">Date/Time: </font><font color="$vlinkcolor">$reporttime</font><br /> |
<font color="$fontcolor">Date/Time: </font><font color="$vlinkcolor">$reporttime</font><br /> |
|; |
|; |
|
|
if ($to =~ m/^[^\@]+\@[^\@]+$/) { |
my $start_page = |
$r->print(<<END); |
&Apache::loncommon::start_page('Support request recorded',undef, |
<html> |
{'function' => $function, |
<head> |
'add_entries' => { |
<title>LON-CAPA support request recorded</title> |
topmargin => "0", |
</head> |
marginheight => "0", |
$bodytag |
}, |
<h3>A support request has been sent to $to</h3> |
'only_body' => 1,}); |
|
|
|
$r->print(<<"END"); |
|
$start_page |
|
<form name="logproblem"> |
|
<input type="hidden" name="action" value="result" /> |
|
</form> |
END |
END |
|
if ($r->uri eq '/adm/helpdesk') { |
|
&print_header($r,$url,'process'); |
|
} |
|
if ($to =~ m/^[^\@]+\@[^\@]+$/) { |
|
$r->print("<h3>A support request has been sent to $to</h3>"); |
} else { |
} else { |
$to = $admin; |
$to = $admin; |
if ($to =~ m/^[^\@]+\@[^\@]+$/) { |
if ($to =~ m/^[^\@]+\@[^\@]+$/) { |
$r->print(<<END); |
$r->print("<h3>A support request has been sent to $to</h3>"); |
<html> |
|
<head> |
|
<title>LON-CAPA support request recorded</title> |
|
</head> |
|
$bodytag |
|
<h3>A support request has been sent to $to</h3> |
|
END |
END |
} else { |
} else { |
$r->print(<<END); |
$r->print(<<END); |
<html> |
|
<head> |
|
<title>LON-CAPA support request recorded</title> |
|
</head> |
|
$bodytag |
|
<h3>Warning: Problem with support e-mail address</h3> |
<h3>Warning: Problem with support e-mail address</h3> |
As the e-mail address provided for this LON-CAPA server ($to) does not appear to be a valid e-mail address, your support request has <b>not</b> been sent to the LON-CAPA support staff or administrator at your institution. Instead a copy has been sent to the LON-CAPA support team at Michigan State University. |
As the e-mail address provided for this LON-CAPA server ($to) does not appear to be a valid e-mail address, your support request has <b>not</b> been sent to the LON-CAPA support staff or administrator at your institution. Instead a copy has been sent to the LON-CAPA support team at Michigan State University. |
END |
END |
$to = 'helpdesk@lon-capa.org'; |
$to = 'helpdesk@lon-capa.org'; |
} |
} |
} |
} |
if (defined($ENV{'form.email'})) { |
if (defined($env{'form.email'})) { |
if ($ENV{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) { |
if ($env{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) { |
$from = $ENV{'form.email'}; |
$from = $env{'form.email'}; |
} |
} |
} |
} |
|
|
my $subject = $ENV{'form.subject'}; |
my $subject = $env{'form.subject'}; |
$subject =~ s#(`)#'#g; |
$subject =~ s#(`)#'#g; |
$subject =~ s#\$#\(\$\)#g; |
$subject =~ s#\$#\(\$\)#g; |
$supportmsg =~ s#(`)#'#g; |
$supportmsg =~ s#(`)#'#g; |
Line 656 END
|
Line 750 END
|
|
|
my $attachmentpath = ''; |
my $attachmentpath = ''; |
my $attachmentsize = ''; |
my $attachmentsize = ''; |
if (defined($ENV{'user.name'})) { |
if (defined($env{'user.name'})) { |
if ($ENV{'form.screenshot.filename'}) { |
if ($env{'form.screenshot.filename'}) { |
$attachmentsize = length($ENV{'form.screenshot'}); |
$attachmentsize = length($env{'form.screenshot'}); |
if ($attachmentsize > 131072) { |
if ($attachmentsize > 131072) { |
$displaymsg .= "<br />The uploaded screenshot file ($attachmentsize bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded."; |
$displaymsg .= "<br />The uploaded screenshot file ($attachmentsize bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded."; |
} else { |
} else { |
Line 667 END
|
Line 761 END
|
} |
} |
} |
} |
|
|
|
my %cookies = (); |
|
my $cookie=CGI::Cookie->parse($r->header_in('Cookie')); |
|
if ($$cookie{'lonID'} =~ /lonID=(\w+);/) { |
|
$cookies{'lonID'} = $1; |
|
} |
|
|
if ($attachmentpath =~ m-/([^/]+)$-) { |
if ($attachmentpath =~ m-/([^/]+)$-) { |
$fname = $1; |
$fname = $1; |
$displaymsg .= "<br />An uploaded screenshot file - $fname ($attachmentsize bytes) was included in the request sent by $ENV{'user.name'} from LON-CAPA domain: $ENV{'user.domain'}"; |
$displaymsg .= "<br />An uploaded screenshot file - $fname ($attachmentsize bytes) was included in the request sent by $env{'user.name'} from LON-CAPA domain: $env{'user.domain'}"; |
$supportmsg .= "\n"; |
$supportmsg .= "\n"; |
foreach (@envvars) { |
foreach (@cookievars) { |
|
$supportmsg .= "$_: $cookies{$_}\n"; |
|
} |
|
foreach (@ENVvars) { |
$supportmsg .= "$_: $ENV{$_}\n"; |
$supportmsg .= "$_: $ENV{$_}\n"; |
} |
} |
|
foreach (@envvars) { |
|
$supportmsg .= "$_: $env{$_}\n"; |
|
} |
} |
} |
|
|
my $msg = MIME::Lite->new( |
my $msg = MIME::Lite->new( |
Line 693 END
|
Line 799 END
|
|
|
} else { |
} else { |
my $envdata = ''; |
my $envdata = ''; |
foreach (@envvars) { |
foreach (@cookievars) { |
|
$envdata .= "$_: $cookies{$_}\n"; |
|
} |
|
foreach (@ENVvars) { |
$envdata .= "$_: $ENV{$_}\n"; |
$envdata .= "$_: $ENV{$_}\n"; |
} |
} |
|
foreach (@envvars) { |
|
$envdata .= "$_: $env{$_}\n"; |
|
} |
foreach (@loncvars) { |
foreach (@loncvars) { |
$envdata .= "$_: $ENV{$_}\n"; |
$envdata .= "$_: $env{$_}\n"; |
} |
} |
$msg->attach(Type => 'TEXT', |
$msg->attach(Type => 'TEXT', |
Data => $envdata); |
Data => $envdata); |
} |
} |
|
|
### Send it: |
### Send it: |
# ->send can cause an sh launch which can pass all of %ENV along |
|
# which can be to large for /bin/sh's little mind |
|
my %oldENV=%ENV; |
|
undef(%ENV); |
|
$msg->send('sendmail'); |
$msg->send('sendmail'); |
%ENV=%oldENV; |
|
undef(%oldENV); |
|
|
|
if ($attachmentpath =~ m#$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+#) { |
if ($attachmentpath =~ m#$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+#) { |
unlink($attachmentpath); |
unlink($attachmentpath); |
Line 763 END
|
Line 869 END
|
<tr> |
<tr> |
<td> |
<td> |
|); |
|); |
foreach (@envvars) { |
foreach (@cookievars) { |
unless($ENV{$_} eq '') { |
unless($cookies{$_} eq '') { |
|
$r->print("$_: <font color='$vlinkcolor'>$cookies{$_}</font>, "); |
|
} |
|
} |
|
foreach (@ENVvars) { |
|
unless($ENV{$_} eq '') { |
$r->print("$_: <font color='$vlinkcolor'>$ENV{$_}</font>, "); |
$r->print("$_: <font color='$vlinkcolor'>$ENV{$_}</font>, "); |
} |
} |
} |
} |
|
foreach (@envvars) { |
|
unless($env{$_} eq '') { |
|
$r->print("$_: <font color='$vlinkcolor'>$env{$_}</font>, "); |
|
} |
|
} |
$r->print(" |
$r->print(" |
</td> |
</td> |
</tr> |
</tr> |
Line 785 END
|
Line 901 END
|
</tr> |
</tr> |
</table> |
</table> |
"); |
"); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} |
|
|
|
sub print_header { |
|
my ($r,$origurl,$action) = @_; |
|
my $location=&Apache::loncommon::lonhttpdurl("/adm"); |
|
my $tablecolor = '#EEEE99'; |
|
my ($component_url); |
|
my $helpdesk_link = '<a href="javascript:validate()">'; |
|
if ($action eq 'process') { |
|
$helpdesk_link = '<a href="/adm/helpdesk">'; |
|
} |
|
my %lt = &Apache::lonlocal::texthash ( |
|
login => 'Log-in help', |
|
ask => 'Ask helpdesk', |
|
getst => 'Getting started guide', |
|
back => 'Back to last location' |
|
); |
|
my ($getstartlink,$getstarttext); |
|
if (-e $Apache::lonnet::perlvar{'lonDocRoot'}.'/adm/gettingstarted.html') { |
|
$getstartlink = qq|<td align="center"> <b><a href="/adm/gettingstarted.html">$lt{'getst'}</a></td>|; |
|
$getstarttext = ' '.&mt('and the "Getting started" guide').' '; |
|
} |
|
$r->print(<<END); |
|
<table width="620" border="0" cellspacing="0" cellpadding="0" height="55"> <tr height="50"> <td width='5'> </td> |
|
<td> |
|
<fieldset><legend><img src="$location/lonIcons/minilogo.gif" height='20' width='29' valign='bottom' /> <b><font size="+1">LON-CAPA help/support</font></b></legend> |
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000"> |
|
<tr> |
|
<td> |
|
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000"> |
|
<tr> |
|
<td> |
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff"> |
|
<tr> |
|
<td> |
|
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff"> |
|
<tr bgcolor="$tablecolor"> |
|
<td align="center"><img src="$location/help/gif/smallHelp.gif" border="0" alt="(Login help)" valign="middle" /> <b><a href="/adm/loginproblems.html">$lt{'login'}</a></td> |
|
<td align="center"> <b>$helpdesk_link<img src="$location/lonIcons/helpdesk.gif" border="0" alt="(Ask helpdesk)" valign="middle" /> $lt{'ask'}</a></b> </td>$getstartlink |
|
<td align="center"> <b><a href="$origurl" target="_top"><img src="$location/lonIcons/move_up.gif" border="0" alt="(Back to last location)" valign="middle" /> $lt{'back'}</a></b> </td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</fieldset> |
|
</td> |
|
<td width='5'> </td> |
|
</tr> |
|
<tr height='5'> |
|
<td colspan='3' height='5'> </td> |
|
</tr> |
|
END |
|
unless ($action eq 'process') { |
|
$r->print(' |
|
<tr> |
|
<td colspan="3">'.&mt(' |
|
Please review the information in "Log-in help"').$getstarttext.' '.&mt('if you are unable to log-in').'. '.&mt('If your problem is still unresolved, the form below can be used to send a question to the LON-CAPA helpdesk').'.<br /><font size="-1"><b>'.&mt('Note').':</b> '.&mt('Student questions about course content should be directed to the course instructor').'.</font><br /><br /> |
|
</td> |
|
</tr>'); |
|
} |
|
$r->print(' |
|
</table>'); |
|
return; |
} |
} |
|
|
sub retrieve_instcodes { |
sub retrieve_instcodes { |
my ($coursecodes,$codedom,$totcodes) = @_; |
my ($coursecodes,$codedom,$totcodes) = @_; |
my %courses = &Apache::lonnet::courseiddump($codedom,'.',1,'.','.'); |
my %courses = &Apache::lonnet::courseiddump($codedom,'.',1,'.','.','.', |
|
undef,undef,'Course'); |
foreach my $course (keys %courses) { |
foreach my $course (keys %courses) { |
if ($courses{$course} =~ m/^[^:]*:([^:]+)/) { |
if ($courses{$course} =~ m/^[^:]*:([^:]+)/) { |
$$coursecodes{$course} = &Apache::lonnet::unescape($1); |
$$coursecodes{$course} = &unescape($1); |
$totcodes ++; |
$totcodes ++; |
} |
} |
} |
} |
Line 851 sub build_code_selections {
|
Line 1039 sub build_code_selections {
|
my @sorted_b = (); |
my @sorted_b = (); |
my @sorted_b_titles = (); |
my @sorted_b_titles = (); |
&sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[2]}{$key_a}{$key_b}},\@sorted_b); |
&sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[2]}{$key_a}{$key_b}},\@sorted_b); |
if (defined($$cat_titles{$$codetitles[1]})) { |
if (defined($$cat_titles{$$codetitles[2]})) { |
foreach (@sorted_b) { |
foreach (@sorted_b) { |
push @sorted_b_titles, $$cat_titles{$$codetitles[1]}{$_}; |
push @sorted_b_titles, $$cat_titles{$$codetitles[2]}{$_}; |
} |
} |
} |
} |
$$idlist{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b); |
$$idlist{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b); |
Line 871 sub build_code_selections {
|
Line 1059 sub build_code_selections {
|
%{$$idlist{$$codetitles[3]}{$key_a}{$key_b}} = (); |
%{$$idlist{$$codetitles[3]}{$key_a}{$key_b}} = (); |
foreach my $key_c (keys %{$idarrays{$$codetitles[3]}{$key_a}{$key_b}}) { |
foreach my $key_c (keys %{$idarrays{$$codetitles[3]}{$key_a}{$key_b}}) { |
my @sorted_c = (); |
my @sorted_c = (); |
|
my @sorted_c_titles = (); |
&sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[3]}{$key_a}{$key_b}{$key_c}},\@sorted_c); |
&sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[3]}{$key_a}{$key_b}{$key_c}},\@sorted_c); |
|
if (defined($$cat_titles{$$codetitles[3]})) { |
|
foreach (@sorted_c) { |
|
push @sorted_c_titles, $$cat_titles{$$codetitles[3]}{$_}; |
|
} |
|
} |
$$idlist{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = join('","',@sorted_c); |
$$idlist{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = join('","',@sorted_c); |
$$idnums{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = scalar(@sorted_c); |
$$idnums{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = scalar(@sorted_c); |
|
if (defined($$cat_titles{$$codetitles[3]})) { |
|
$$idlist_titles{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_c_titles); |
|
} |
} |
} |
} |
} |
} |
} |
Line 887 sub build_code_selections {
|
Line 1084 sub build_code_selections {
|
%{$$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}} = (); |
%{$$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}} = (); |
foreach my $key_d (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}}) { |
foreach my $key_d (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}}) { |
my @sorted_d = (); |
my @sorted_d = (); |
|
my @sorted_d_titles = (); |
&sort_cats($num,$cat_order,$codetitles,$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d},\@sorted_d); |
&sort_cats($num,$cat_order,$codetitles,$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d},\@sorted_d); |
|
if (defined($$cat_titles{$$codetitles[4]})) { |
|
foreach (@sorted_d) { |
|
push @sorted_d_titles, $$cat_titles{$$codetitles[4]}{$_}; |
|
} |
|
} |
$$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = join('","',@sorted_d); |
$$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = join('","',@sorted_d); |
$$idnums{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = scalar(@sorted_d); |
$$idnums{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = scalar(@sorted_d); |
} |
} |
Line 902 sub sort_cats {
|
Line 1105 sub sort_cats {
|
my ($num,$cat_order,$codetitles,$idsarrayref,$sorted) = @_; |
my ($num,$cat_order,$codetitles,$idsarrayref,$sorted) = @_; |
my @unsorted = @{$idsarrayref}; |
my @unsorted = @{$idsarrayref}; |
if (defined($$cat_order{$$codetitles[$num]})) { |
if (defined($$cat_order{$$codetitles[$num]})) { |
foreach (@{$$cat_order{$$codetitles[$num]}}) { |
foreach my $item (@{$$cat_order{$$codetitles[$num]}}) { |
if (grep/^$_$/,@unsorted) { |
if (grep/^\Q$item\E$/,@unsorted) { |
push @{$sorted}, $_; |
push @{$sorted}, $item; |
} |
} |
} |
} |
} else { |
} else { |
Line 993 sub recurse_list {
|
Line 1196 sub recurse_list {
|
} |
} |
|
|
sub javascript_code_selections { |
sub javascript_code_selections { |
my ($numcats,$script_tag,$idlist,$idnums,$idlist_titles,$codetitles) = @_; |
my ($formname,$numcats,$cat_titles,$script_tag,$idlist,$idnums,$idlist_titles,$codetitles) = @_; |
my $numtitles = @{$codetitles}; |
my $numtitles = @{$codetitles}; |
my @seltitles = (); |
my @seltitles = (); |
for (my $j=0; $j<$numtitles; $j++) { |
for (my $j=0; $j<$numtitles; $j++) { |
$seltitles[$j] = 'id'.$$codetitles[$j]; |
$seltitles[$j] = 'id'.$$codetitles[$j]; |
} |
} |
my $seltitle_str = join('","',@seltitles); |
my $seltitle_str = join('","',@seltitles); |
|
my @longtitles = (); |
|
for (my $i=0; $i<$numtitles; $i++) { |
|
if (defined($$cat_titles{$$codetitles[$i]})) { |
|
$longtitles[$i] = 1; |
|
} else { |
|
$longtitles[$i] = 0; |
|
} |
|
} |
|
my $longtitles_str = join('","',@longtitles); |
$$script_tag .= <<END; |
$$script_tag .= <<END; |
function courseSet(caller) { |
function courseSet(caller) { |
var ids = new Array ("$seltitle_str"); |
var ids = new Array ("$seltitle_str"); |
var formitems = new Array ($numtitles); |
var formitems = new Array ($numtitles); |
var idyr = document.forms.logproblem.Year.selectedIndex |
var longtitles = new Array ("$longtitles_str"); |
var idsem = document.forms.logproblem.Semester.selectedIndex |
var idyr = document.$formname.Year.selectedIndex |
var iddept = document.forms.logproblem.Department.selectedIndex |
var idsem = document.$formname.Semester.selectedIndex |
var idclass = document.forms.logproblem.Number.selectedIndex |
var iddept = document.$formname.Department.selectedIndex |
|
var idclass = document.$formname.Number.selectedIndex |
var idyears = new Array("$$idlist{$$codetitles[0]}"); |
var idyears = new Array("$$idlist{$$codetitles[0]}"); |
var idsems = new Array ($$idnums{$$codetitles[0]}); |
|
var idsemlongs = new Array ($$idnums{$$codetitles[0]}); |
|
var idcodes = new Array ($$idnums{$$codetitles[0]}); |
|
var idcourses = new Array ($$idnums{$$codetitles[0]}); |
|
END |
END |
my @sort_a = split/","/,$$idlist{$$codetitles[0]}; |
if ($longtitles[0]) { |
|
$$script_tag .= |
|
qq| var idyearslongs = new Array("$$idlist_titles{$$codetitles[0]}")\n|; |
|
} |
|
$$script_tag .= |
|
" var idsems = new Array ($$idnums{$$codetitles[0]})\n"; |
|
if ($longtitles[1]) { |
|
$$script_tag .= |
|
" var idsemslongs = new Array ($$idnums{$$codetitles[0]})\n"; |
|
} |
|
$$script_tag .= |
|
" var idcodes = new Array ($$idnums{$$codetitles[0]})\n"; |
|
if ($longtitles[2]) { |
|
$$script_tag .= |
|
" var idcodeslongs = new Array ($$idnums{$$codetitles[0]})\n"; |
|
} |
|
$$script_tag .= |
|
" var idcourses = new Array ($$idnums{$$codetitles[0]})\n"; |
|
if ($longtitles[3]) { |
|
$$script_tag .= |
|
" var idcourseslongs = new Array ($$idnums{$$codetitles[0]})\n"; |
|
} |
|
my @sort_a = split/","/,$$idlist{$$codetitles[0]}; |
for (my $j=0; $j<@sort_a; $j++) { |
for (my $j=0; $j<@sort_a; $j++) { |
$$script_tag .= qq| idsems[$j] = new Array("$$idlist{$$codetitles[1]}{$sort_a[$j]}")\n|; |
$$script_tag .= qq| idsems[$j] = new Array("$$idlist{$$codetitles[1]}{$sort_a[$j]}")\n|; |
$$script_tag .= qq| idsemlongs[$j] = new Array("$$idlist_titles{$$codetitles[1]}{$sort_a[$j]}")\n|; |
if ($longtitles[1]) { |
|
$$script_tag .= qq| idsemslongs[$j] = new Array("$$idlist_titles{$$codetitles[1]}{$sort_a[$j]}")\n|; |
|
} |
$$script_tag .= qq| idcodes[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|; |
$$script_tag .= qq| idcodes[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|; |
|
if ($longtitles[2]) { |
|
$$script_tag .= qq| idcodeslongs[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|; |
|
} |
$$script_tag .= qq| idcourses[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|; |
$$script_tag .= qq| idcourses[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|; |
|
if ($longtitles[3]) { |
|
$$script_tag .= qq| idcourseslongs[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|; |
|
} |
my @sort_b = split/","/,$$idlist{$$codetitles[1]}{$sort_a[$j]}; |
my @sort_b = split/","/,$$idlist{$$codetitles[1]}{$sort_a[$j]}; |
for (my $k=0; $k<@sort_b; $k++) { |
for (my $k=0; $k<@sort_b; $k++) { |
my $idcode_entry = $$idlist{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]}; |
my $idcode_entry = $$idlist{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]}; |
$$script_tag .= qq| idcodes[$j][$k] = new Array("$idcode_entry")\n|; |
$$script_tag .= qq| idcodes[$j][$k] = new Array("$idcode_entry")\n|; |
|
if ($longtitles[2]) { |
|
my $idcodelong_entry = $$idlist_titles{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]}; |
|
$$script_tag .= qq| idcodeslongs[$j][$k] = new Array("$idcodelong_entry")\n|; |
|
} |
$$script_tag .= qq| idcourses[$j][$k] = new Array($$idnums{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]})\n|; |
$$script_tag .= qq| idcourses[$j][$k] = new Array($$idnums{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]})\n|; |
|
if ($longtitles[3]) { |
|
$$script_tag .= qq| idcourseslongs[$j][$k] = new Array($$idnums{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]})\n|; |
|
} |
my @sort_c = split/","/,$$idlist{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]}; |
my @sort_c = split/","/,$$idlist{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]}; |
for (my $l=0; $l<@sort_c; $l++) { |
for (my $l=0; $l<@sort_c; $l++) { |
my $idcourse_entry = $$idlist{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]}; |
my $idcourse_entry = $$idlist{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]}; |
$$script_tag .= qq| idcourses[$j][$k][$l] = new Array("$idcourse_entry")\n|; |
$$script_tag .= qq| idcourses[$j][$k][$l] = new Array("$idcourse_entry")\n|; |
|
if ($longtitles[3]) { |
|
my $idcourselong_entry = $$idlist_titles{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]}; |
|
$$script_tag .= qq| idcourseslongs[$j][$k][$l] = new Array("$idcourselong_entry")\n|; |
|
} |
} |
} |
} |
} |
} |
} |
$$script_tag .= (<<END_OF_BLOCK); |
$$script_tag .= (<<END_OF_BLOCK); |
if (caller == "Year") { |
var display = new Array($numtitles) |
document.forms.logproblem.Department.length = 0 |
if (caller == "" || caller == "$$codetitles[0]") { |
document.forms.logproblem.Number.length = 0 |
if (caller == "") { |
document.forms.logproblem.Department.options[0] = new Option("<-Pick Semester.","-1",true,true) |
document.$formname.Year.length = 0 |
document.forms.logproblem.Number.options[0] = new Option("<-Pick Department","-1",true,true) |
document.$formname.Year.options[0] = new Option("Select","-1",true,true) |
if (idyr == 0) { |
display[0] = new Array(idyears.length) |
document.forms.logproblem.Semester.length = 0 |
for (var i=0; i<idyears.length; i++) { |
document.forms.logproblem.Semester.options[0] = new Option("<-Pick Year","-1",true,true) |
display[0][i] = idyears[i] |
} |
if (longtitles[0] == 1) { |
else { |
if (idyearslongs[i] != "") { |
document.forms.logproblem.Semester.length = 0 |
display[0][i] = idyearslongs[i] |
document.forms.logproblem.Semester.options[0] = new Option("Select","-1",true,true) |
} |
for (var i=0; i<idsems[idyr-1].length; i++) { |
} |
document.forms.logproblem.Semester.options[i+1] = new Option(idsemlongs[idyr-1][i],idsems[idyr-1][i],false,false) |
else { |
} |
if (idyearslongs[i] != "") { |
} |
display[0][i] = idyears[i] |
document.forms.logproblem.Semester.selectedIndex = 0; |
} |
|
} |
|
document.$formname.Year.options[i+1] = new Option(display[0][i],idyears[i],false,false) |
|
} |
|
document.$formname.Year.selectedIndex = 0; |
|
} |
|
document.$formname.Semester.length = 0 |
|
document.$formname.Department.length = 0; |
|
document.$formname.Number.length = 0 |
|
document.$formname.Department.options[0] = new Option("<-Pick $$codetitles[1]","-1",true,true) |
|
document.$formname.Number.options[0] = new Option("<-Pick $$codetitles[2]","-1",true,true) |
|
if (idyr == 0 || caller == "") { |
|
document.$formname.Semester.options[0] = new Option("<-Pick $$codetitles[0]","-1",true,true) |
|
} |
|
else { |
|
document.$formname.Semester.options[0] = new Option("Select","-1",true,true) |
|
display[1] = new Array(idsems[idyr-1].length) |
|
for (var i=0; i<idsems[idyr-1].length; i++) { |
|
display[1][i] = idsems[idyr-1][i] |
|
if (longtitles[1] == 1) { |
|
if (idsemslongs[idyr-1][i] != "") { |
|
display[1][i] = idsemslongs[idyr-1][i] |
|
} |
|
} |
|
document.$formname.Semester.options[i+1] = new Option(display[1][i],idsems[idyr-1][i],false,false) |
|
} |
|
} |
|
document.$formname.Semester.selectedIndex = 0; |
} |
} |
if (caller == "Semester") { |
if (caller == "$$codetitles[1]") { |
document.forms.logproblem.Department.length = 0 |
document.$formname.Department.length = 0 |
document.forms.logproblem.Number.length = 0 |
document.$formname.Number.length = 0 |
document.forms.logproblem.Number.options[0] = new Option("<-Pick Department.","-1",true,true) |
document.$formname.Number.options[0] = new Option("<-Pick $$codetitles[2]","-1",true,true) |
if (idsem == 0) { |
if (idsem == 0) { |
document.forms.logproblem.Department.options[0] = new Option("<-Pick Semester.","-1",true,true) |
document.$formname.Department.options[0] = new Option("<-Pick $$codetitles[1]","-1",true,true) |
document.forms.logproblem.Department.options[0] = new Option("<-Pick Semester","-1",true,true) |
|
} |
} |
else { |
else { |
document.forms.logproblem.Department.options[0] = new Option("Select","-1",true,true) |
document.$formname.Department.options[0] = new Option("Select","-1",true,true) |
|
display[2] = new Array(idcodes[idyr-1][idsem-1].length) |
for (var i=0; i<idcodes[idyr-1][idsem-1].length; i++) { |
for (var i=0; i<idcodes[idyr-1][idsem-1].length; i++) { |
document.forms.logproblem.Department.options[i+1] = new Option(idcodes[idyr-1][idsem-1][i],idcodes[idyr-1][idsem-1][i],false,false) |
display[2][i] = idcodes[idyr-1][idsem-1][i] |
|
if (longtitles[2] == 1) { |
|
if (idcodeslongs[idyr-1][idsem-1][i] != "") { |
|
display[2][i] = idcodeslongs[idyr-1][idsem-1][i] |
|
} |
|
} |
|
document.$formname.Department.options[i+1] = new Option(display[2][i],idcodes[idyr-1][idsem-1][i],false,false) |
} |
} |
} |
} |
document.forms.logproblem.Department.selectedIndex = 0 |
document.$formname.Department.selectedIndex = 0 |
} |
} |
if (caller == "Department") { |
if (caller == "$$codetitles[2]") { |
document.forms.logproblem.Number.length = 0 |
document.$formname.Number.length = 0 |
if (iddept == 0) { |
if (iddept == 0) { |
document.forms.logproblem.Number.options[0] = new Option("<-Pick Department.","-1",true,true) |
document.$formname.Number.options[0] = new Option("<-Pick $$codetitles[2]","-1",true,true) |
} |
} |
else { |
else { |
document.forms.logproblem.Number.options[0] = new Option("Select","-1",true,true) |
document.$formname.Number.options[0] = new Option("Select","-1",true,true) |
|
display[3] = new Array (idcourses[idyr-1][idsem-1][iddept-1].length) |
for (var i=0; i<idcourses[idyr-1][idsem-1][iddept-1].length; i++) { |
for (var i=0; i<idcourses[idyr-1][idsem-1][iddept-1].length; i++) { |
document.forms.logproblem.Number.options[i+1] = new Option(idcourses[idyr-1][idsem-1][iddept-1][i],idcourses[idyr-1][idsem-1][iddept-1][i],false,false) |
display[3][i] = idcourses[idyr-1][idsem-1][iddept-1][i] |
|
if (longtitles[3] == 1) { |
|
if (idcourseslongs[idyr-1][idsem-1][iddept-1][i] != "") { |
|
display[3][i] = idcourseslongs[idyr-1][idsem-1][iddept-1][i] |
|
} |
|
} |
|
document.$formname.Number.options[i+1] = new Option(display[3][i],idcourses[idyr-1][idsem-1][iddept-1][i],false,false) |
} |
} |
} |
} |
document.forms.logproblem.Number.selectedIndex = 0 |
document.$formname.Number.selectedIndex = 0 |
} |
} |
} |
} |
|
|
|
function initialize_codes() { |
|
courseSet(); |
|
return; |
|
} |
END_OF_BLOCK |
END_OF_BLOCK |
} |
} |
|
|