Annotation of loncom/interface/lonsupportreq.pm, revision 1.6
1.1 raeburn 1: package Apache::lonsupportreq;
2:
3: use strict;
4: use lib qw(/home/httpd/lib/perl);
1.5 raeburn 5: use MIME::Types;
6: use MIME::Lite;
1.1 raeburn 7: use Apache::Constants qw(:common);
1.2 albertel 8: use Apache::loncommon();
9: use Apache::lonnet();
1.1 raeburn 10: use Apache::lonlocal;
11:
12: sub handler {
1.2 albertel 13: my ($r) = @_;
14: &Apache::loncommon::content_type($r,'text/html');
1.1 raeburn 15: $r->send_http_header;
16:
17: if ($r->header_only) {
18: return OK;
19: }
20:
21: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','origurl','function']);
22: my $action = $ENV{'form.action'};
23: my $function = $ENV{'form.function'};
24: my $origurl = &Apache::lonnet::unescape($ENV{'form.origurl'});
25: if ($action eq 'process') {
26: &print_request_receipt($r,$origurl,$function);
27: } else {
28: &print_request_form($r,$origurl,$function);
29: }
30: return OK;
31: }
32:
33: sub print_request_form {
34: my ($r,$origurl,$function) = @_;
35: my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid,$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server);
36: my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0",marginheight="0"',1);
37: my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
1.5 raeburn 38: if (($tablecolor eq '') || ($tablecolor eq '#FFFFFF')) {
39: $tablecolor = '#CCCCFF';
40: }
1.1 raeburn 41: $os = $ENV{'browser.os'};
42: $browser = $ENV{'browser.type'};
43: $bversion = $ENV{'browser.version'};
44: $uhost = $ENV{'request.host'};
45: $uname = $ENV{'user.name'};
46: $udom = $ENV{'user.domain'};
47: $uhome = $ENV{'user.home'};
48: $urole = $ENV{'request.role'};
49: $usec = $ENV{'request.course.sec'};
50: $cid = $ENV{'request.course.id'};
51: $server = $ENV{'SERVER_NAME'};
1.5 raeburn 52: my $scripttag = (<<END);
53: function validate() {
54: if (document.logproblem.email.value.indexOf("\@") == -1) {
55: alert("You must enter a valid e-mail address");
56: return
57: }
58: document.logproblem.submit();
59: }
60: END
1.1 raeburn 61: if ($cid =~ m/_/) {
62: ($cdom,$cnum) = split/_/,$cid;
63: }
64: if ($cdom && $cnum) {
65: my %csettings = &Apache::lonnet::get('environment',['description','internal.coursecode','internal.sectionnums'],$cdom,$cnum);
66: $ctitle = $csettings{'description'};
67: $ccode = $csettings{'internal.coursecode'};
68: $sectionlist = $csettings{'internal.sectionnums'};
69: }
70: if ($ENV{'environment.critnotification'}) {
71: $email = $ENV{'environment.critnotification'};
72: }
73: if (!$email && $ENV{'environment.notification'}) {
74: $email = $ENV{'environment.notification'};
75: }
76: if ($ENV{'environment.lastname'}) {
77: $lastname = $ENV{'environment.lastname'};
78: }
79: if ($ENV{'environment.firstname'}) {
80: $firstname = $ENV{'environment.firstname'};
81: }
82: my @sections = split/,/,$sectionlist;
83: my %groupid = ();
84: foreach (@sections) {
85: my ($sec,$grp) = split/:/,$_;
86: $groupid{$sec} = $grp;
87: }
88: my $defdom = $Apache::lonnet::perlvar{'lonDefDomain'};
89: my $codedom = $defdom;
90: my %coursecodes = ();
91: my %codes = ();
92: my @codetitles = ();
93: my %cat_titles = ();
94: my %cat_order = ();
1.6 ! raeburn 95: my %idlist = ();
! 96: my %idnums = ();
! 97: my %idlist_titles = ();
1.1 raeburn 98: my $caller = 'global';
99: my $totcodes = 0;
100: my $format_reply;
1.6 ! raeburn 101: my $jscript = '';
1.1 raeburn 102:
103: if ($cdom) {
104: $codedom = $cdom;
105: }
106: if ($cnum) {
107: $coursecodes{$cnum} = $ccode;
108: if ($ccode eq '') {
109: $totcodes = &retrieve_instcodes(\%coursecodes,$codedom,$totcodes);
110: } else {
111: $coursecodes{$cnum} = $ccode;
112: $caller = $cnum;
113: $totcodes ++;
114: }
115: } else {
116: $totcodes = &retrieve_instcodes(\%coursecodes,$codedom,$totcodes);
117: }
118: if ($totcodes > 0) {
119: $format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order);
1.6 ! raeburn 120: if ($ccode eq '') {
! 121: my $numtypes = @codetitles;
! 122: &build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles);
! 123: &javascript_code_selections($numtypes,\$jscript,\%idlist,\%idnums,\%idlist_titles,\@codetitles);
! 124: }
1.1 raeburn 125: }
126: $r->print(<<END);
127: <html>
128: <head>
129: <title>LON-CAPA support request</title>
1.6 ! raeburn 130: <script>
1.1 raeburn 131: $scripttag
1.6 ! raeburn 132: $jscript
! 133: </script>
1.1 raeburn 134: </head>
135: $bodytag
136: <table width="580" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
137: <tr>
138: <td>
139: <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
140: <tr>
141: <td>
142: <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
143: <tr>
144: <td>
145: <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">
1.5 raeburn 146: <form method="post" name="logproblem" enctype="multipart/form-data">
1.1 raeburn 147: <tr>
148: <td width="140" bgcolor="$tablecolor">
149: <table width="140" border="0" cellpadding="8" cellspacing="0">
150: <tr>
151: <td align="right"><b>Name:</b>
152: </td>
153: </tr>
154: </table>
155: </td>
156: <td width="100%" valign="top">
157: <table width="100%" border="0" cellpadding="8" cellspacing="0">
158: <tr>
159: <td>
160: END
161: my $fullname = '';
162: if ((defined($lastname) && $lastname ne '') && (defined($firstname) && $firstname ne '')) {
163: $fullname = "$firstname $lastname";
164: $r->print("$fullname<input type=\"hidden\" name=\"username\" value=\"$fullname\" />");
165: } else {
166: if (defined($firstname) && $firstname ne '') {
167: $fullname = $firstname;
168: } elsif (defined($lastname) && $lastname ne '') {
169: $fullname= " $lastname";
170: }
171: $r->print('<input type="text" size="20" name="username" value="'.$fullname.'" /><br />');
172: }
173: $r->print(<<END);
174: </td>
175: </tr>
176: </table>
177: </td>
178: </tr>
179: <tr>
180: <td width="100%" colspan="2" bgcolor="#000000">
1.3 albertel 181: <img src="/adm/lonMisc/blackdot.gif" /><br />
1.1 raeburn 182: </td>
183: </tr>
184: <tr>
185: <td width="140" bgcolor="$tablecolor">
186: <table width="140" border="0" cellpadding="8" cellspacing="0">
187: <tr>
188: <td align="right"><b>E-mail address:</b>
189: </td>
190: </tr>
191: </table>
192: </td>
193: <td width="100%" valign="top">
194: <table width="100%" border="0" cellpadding="8" cellspacing="0">
195: <tr>
196: <td>
197: <input type="text" size="20" name="email" value="$email" /><br />
198: </td>
199: </tr>
200: </table>
201: </td>
202: </tr>
203: <tr>
204: <td width="100%" colspan="2" bgcolor="#000000">
1.3 albertel 205: <img src="/adm/lonMisc/blackdot.gif" /><br />
1.1 raeburn 206: </td>
207: </tr>
208: <tr>
209: <td width="140" bgcolor="$tablecolor">
210: <table width="140" border="0" cellpadding="8" cellspacing="0">
211: <tr>
212: <td align="right"><b>username/domain:</b>
213: </td>
214: </tr>
215: </table>
216: </td>
217: <td width="100%" valign="top">
218: <table width="100%" border="0" cellpadding="8" cellspacing="0">
219: <tr>
220: <td>
221: END
222: my $udom_input = '<input type="hidden" name="udom" value="'.$udom.'" />';
223: my $uname_input = '<input type="hidden" name="uname" value="'.$uname.'" />';
224: if (defined($uname) && defined($udom)) {
225: $r->print('<i>username</i>: '.$uname.' <i>domain</i>: '.$udom.$udom_input.$uname_input);
226: } else {
227: my $udomform = '';
228: my $unameform = '';
229: if (defined($udom)) {
230: $udomform = '<i>domain</i>: '.$udom.$udom_input;
231: } elsif (defined($uname)) {
232: $unameform = '<i>username</i>: '.$uname.' '.$uname_input;
233: }
234: if ($udomform eq '') {
235: $udomform = '<i>domain</i>: ';
236: $udomform .= &Apache::loncommon::select_dom_form('','udom');
237: }
238: if ($unameform eq '') {
239: $unameform= '<i>username</i>: <input type="text" size="20" name="loncname" value="'.$uname.'" /> ';
240: }
241: $r->print($unameform.$udomform.'<br />Enter the username you use to log-in to your LON-CAPA system, and choose your domain.');
242: }
243: $r->print(<<END);
244: </td>
245: </tr>
246: </table>
247: </td>
248: </tr>
249: <tr>
250: <td width="100%" colspan="2" bgcolor="#000000">
1.3 albertel 251: <img src="/adm/lonMisc/blackdot.gif" /><br />
1.1 raeburn 252: </td>
253: </tr>
254: <tr>
255: <td width="140" bgcolor="$tablecolor">
256: <table width="140" border="0" cellpadding="8" cellspacing="0">
257: <tr>
258: <td align="right"><b>URL of page:</b>
259: </td>
260: </tr>
261: </table>
262: </td>
263: <td width="100%" valign="top">
264: <table width="100%" border="0" cellpadding="8" cellspacing="0">
265: <tr>
266: <td>
1.5 raeburn 267: http://$server$origurl<input type="hidden" name="origurl" value="http://$server$origurl" />
1.1 raeburn 268: </td>
269: </tr>
270: </table>
271: </td>
272: </tr>
273: <tr>
274: <td width="100%" colspan="2" bgcolor="#000000">
1.3 albertel 275: <img src="/adm/lonMisc/blackdot.gif" /><br />
1.1 raeburn 276: </td>
277: </tr>
278: <tr>
279: <td width="140" bgcolor="$tablecolor">
280: <table width="140" border="0" cellpadding="8" cellspacing="0">
281: <tr>
282: <td align="right"><b>Phone #:</b>
283: </td>
284: </tr>
285: </table>
286: </td>
287: <td width="100%" valign="top">
288: <table width="100%" border="0" cellpadding="8" cellspacing="0">
289: <tr>
290: <td>
291: <input type="text" size="15" name="phone"><br>
292: </td>
293: </tr>
294: </table>
295: </td>
296: </tr>
297: <tr>
298: <td width="100%" colspan="2" bgcolor="#000000">
1.3 albertel 299: <img src="/adm/lonMisc/blackdot.gif" /><br />
1.1 raeburn 300: </td>
301: </tr>
302: <tr>
303: <td width="140" bgcolor="$tablecolor">
304: <table width="140" border="0" cellpadding="8" cellspacing="0">
305: <tr>
306: <td align="right"><b>Course Details:</b>
307: </td>
308: </tr>
309: </table>
310: </td>
311: <td width="100%" valign="top">
312: <table border="0" cellpadding="3" cellspacing="3">
313: <tr>
314: <td>
315: END
316: if ($coursecodes{$cnum}) {
317: foreach (@codetitles) {
1.5 raeburn 318: $r->print('<i>'.$_.'</i>: '.$codes{$cnum}{$_}.'; ');
1.1 raeburn 319: }
1.5 raeburn 320: $r->print(' <input type="hidden" name="coursecode" value="'.$coursecodes{$cnum}.'" />');
1.1 raeburn 321: } else {
322: $r->print('Enter institutional course code:
323: <input type="text" name="coursecode" size="15" value="" />');
324: }
325: if ($ctitle) {
326: $r->print('<br /><i>Title</i>: '.$ctitle.'<input type="hidden" name="title" value="'.$ctitle.'" />');
327: } else {
328: $r->print('<br />Enter course title:
329: <input type="text" name="title" size="15" value="" />');
330: }
331: $r->print(<<END);
332: </td>
333: </tr>
334: </table>
335: </td>
336: </tr>
337: <tr>
338: <td width="100%" colspan="2" bgcolor="#000000">
1.3 albertel 339: <img src="/adm/lonMisc/blackdot.gif" /><br />
1.1 raeburn 340: </td>
341: </tr>
342: <tr>
343: <td width="140" bgcolor="$tablecolor">
344: <table width="140" border="0" cellpadding="8" cellspacing="0">
345: <tr>
346: <td align="right"><b>Section Number: </b>
347: </td>
348: </tr>
349: </table>
350: </td>
351: <td width="100%" valign="top">
352: <table width="100%" border="0" cellpadding="8" cellspacing="0">
353: <tr>
354: <td>
355: END
356: if ($sectionlist) {
357: $r->print("<select name=\"section\">");
358: foreach (sort keys %groupid) {
359: if ($_ eq $groupid{$_} || $groupid{$_} eq '') {
360: $r->print("<option value=\"$_\" />$_");
361: } else {
1.5 raeburn 362: $r->print("<option value=\"$_\" />$_ - (LON-CAPA sec: $groupid{$_})");
1.1 raeburn 363: }
364: }
365: $r->print("</select>");
366: } else {
367: $r->print("<input type=\"text\" name=\"section\" size=\"10\"/>");
368: }
369: $r->print(<<END);
370: </td>
371: </tr>
372: </table>
373: </td>
374: </tr>
375: <tr>
376: <td width="100%" colspan="2" bgcolor="#000000">
1.3 albertel 377: <img src="/adm/lonMisc/blackdot.gif" /><br />
1.1 raeburn 378: </td>
379: </tr>
380: <tr>
381: <td width="140" bgcolor="$tablecolor">
382: <table width="140" border="0" cellpadding="8" cellspacing="0">
383: <tr>
384: <td align="right"><b>Subject</b>
385: </td>
386: </tr>
387: </table>
388: </td>
389: <td width="100%" valign="top">
390: <table width="100%" border="0" cellpadding="8" cellspacing="0">
391: <tr>
392: <td>
393: <input type="text" size="40" name="subject">
394: </td>
395: </tr>
396: </table>
397: </td>
398: </tr>
399: <tr>
400: <td width="100%" colspan="2" bgcolor="#000000">
1.3 albertel 401: <img src="/adm/lonMisc/blackdot.gif" /><br />
1.1 raeburn 402: </td>
403: </tr>
404: <tr>
405: <td width="140" bgcolor="$tablecolor">
406: <table width="140" border="0" cellpadding="8" cellspacing="0">
407: <tr>
408: <td align="right"><b>Detailed description:</b>
409: </td>
410: </tr>
411: </table>
412: </td>
413: <td width="100%" valign="top">
414: <table width="100%" border="0" cellpadding="8" cellspacing="0">
415: <tr>
416: <td>
417: <textarea rows="10" cols="45" name="description" wrap="virtual"></textarea>
418: </td>
419: </tr>
420: </table>
421: </td>
422: </tr>
423: <tr>
424: <td width="100%" colspan="2" bgcolor="#000000">
1.3 albertel 425: <img src="/adm/lonMisc/blackdot.gif" /><br />
1.1 raeburn 426: </td>
427: </tr>
1.5 raeburn 428: END
429: if (defined($ENV{'user.name'})) {
430: $r->print(<<END);
431: <tr>
432: <td width="140" bgcolor="$tablecolor">
433: <table width="140" border="0" cellpadding="8" cellspacing="0">
434: <tr>
435: <td align="right"><b>Optional file upload:</b>
436: </td>
437: </tr>
438: </table>
439: </td>
440: <td width="100%" valign="top">
441: <table width="100%" border="0" cellpadding="8" cellspacing="0">
442: <tr>
443: <td>
444: <input type="file" name="screenshot" size="20" /><br />Upload a file (e.g., a screenshot) relevant to your support request (128 KB max. size).
445: </td>
446: </tr>
447: </table>
448: </td>
449: </tr>
450: <tr>
451: <td width="100%" colspan="2" bgcolor="#000000">
452: <img src="/adm/lonMisc/blackdot.gif" /><br />
453: </td>
454: </tr>
455: END
456: }
457: $r->print(<<END);
1.1 raeburn 458: <tr>
459: <td width="140" bgcolor="$tablecolor">
460: <table width="140" border="0" cellpadding="8" cellspacing="0">
461: <tr>
462: <td align="right"><b>Finish:</b>
463: </td>
464: </tr>
465: </table>
466: </td>
467: <td width="100%" valign="top">
468: <table border="0" cellpadding="8" cellspacing="0">
469: <tr>
470: <td>
471: <input type="hidden" name="action" value="process" />
1.5 raeburn 472: <input type="button" value="Submit Request Form" onClick="validate()"/>
1.1 raeburn 473: </td>
474: <td> </td>
475: <td>
476: <input type="reset" value="Clear Form">
477: </td>
478: </tr>
479: </table>
480: </td>
481: </tr>
482: </table>
483: </td>
484: </tr>
485: </table>
486: </td>
487: </tr>
488: </table>
489: </td>
490: </tr>
491: </table>
492: END
1.5 raeburn 493: return;
1.1 raeburn 494: }
495:
496: sub print_request_receipt {
497: my ($r,$url,$function) = @_;
498: my @envvars = ('lonID','HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME','browser.os','browser.type','browser.version','user.home','request.role');
1.5 raeburn 499: my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id');
500:
1.1 raeburn 501: my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0" marginheight="0"',1);
1.5 raeburn 502: my $admin = $Apache::lonnet::perlvar{'lonAdminMail'};
1.1 raeburn 503: my $to = $Apache::lonnet::perlvar{'lonSupportEMail'};
1.5 raeburn 504: my $from = $admin;
1.1 raeburn 505: my $reporttime = &Apache::lonlocal::locallocaltime(time);
506: my $fontcolor = &Apache::loncommon::designparm($function.'.font');
507: my $vlinkcolor = &Apache::loncommon::designparm($function.'.vlink');
508: my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
1.5 raeburn 509: my @formvars = ('username','email','uname','udom','origurl','phone','section','coursecode','title','subject','description','screenshot');
1.1 raeburn 510: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars);
511:
512: my $supportmsg = qq|
513: Name: $ENV{'form.username'}
514: Email: $ENV{'form.email'}
515: Username/domain: $ENV{'form.uname'} - $ENV{'form.udom'}
516: Tel: $ENV{'form.phone'}
517: Course Information: $ENV{'form.title'} - $ENV{'form.coursecode'} - section: $ENV{'form.section'}
518: Subject: $ENV{'form.subject'}
519: Description: $ENV{'form.description'}
520: URL: $ENV{'form.origurl'}
521: Date/Time: $reporttime
522:
523: |;
1.5 raeburn 524: my $descrip = $ENV{'form.description'};
525: $descrip =~ s#\n#<br />#g;
526: my $displaymsg = qq|
527: <font color="$fontcolor">Name:</font><font color="$vlinkcolor"> $ENV{'form.username'}</font><br />
528: <font color="$fontcolor">Email: </font><font color="$vlinkcolor">$ENV{'form.email'}</font><br />
529: <font color="$fontcolor">Username/domain: </font><font color="$vlinkcolor">$ENV{'form.uname'} - $ENV{'form.udom'}</font><br />
530: <font color="$fontcolor">Tel: </font><font color="$vlinkcolor">$ENV{'form.phone'}</font><br />
531: <font color="$fontcolor">Course Information: </font><font color="$vlinkcolor">$ENV{'form.title'} - $ENV{'form.coursecode'} - section: $ENV{'form.section'}</font><br />
532: <font color="$fontcolor">Subject: </font><font color="$vlinkcolor">$ENV{'form.subject'}</font><br />
533: <font color="$fontcolor">Description: </font><font color="$vlinkcolor">$descrip</font><br />
534: <font color="$fontcolor">URL: </font><font color="$vlinkcolor">$ENV{'form.origurl'}</font><br />
535: <font color="$fontcolor">Date/Time: </font><font color="$vlinkcolor">$reporttime</font><br />
536: |;
537:
1.1 raeburn 538: if ($to =~ m/^[^\@]+\@[^\@]+$/) {
539: $r->print(<<END);
540: <html>
541: <head>
542: <title>LON-CAPA support request recorded</title>
543: </head>
544: $bodytag
545: <h3>A support request has been sent to $to</h3>
546: END
547: } else {
548: $to = 'helpdesk@lon-capa.org';
549: $r->print(<<END);
550: <html>
551: <head>
552: <title>LON-CAPA support request recorded</title>
553: </head>
554: $bodytag
555: <h3>Warning: Problem with support e-mail address</h3>
1.5 raeburn 556: 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 at your institution. Instead a copy has been sent to the LON-CAPA support team at Michigan State University.
1.1 raeburn 557: END
558: }
1.5 raeburn 559: if (defined($ENV{'form.email'})) {
560: if ($ENV{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) {
561: $from = $ENV{'form.email'};
562: }
563: }
564:
565: my $subject = $ENV{'form.subject'};
566: $subject =~ s#(`)#'#g;
567: $subject =~ s#\$#\(\$\)#g;
568: $supportmsg =~ s#(`)#'#g;
569: $supportmsg =~ s#\$#\(\$\)#g;
570: $displaymsg =~ s#(`)#'#g;
571: $displaymsg =~ s#\$#\(\$\)#g;
572: my $fname;
573:
574: my $attachmentpath = '';
575: my $attachmentsize = '';
576: if (defined($ENV{'user.name'})) {
577: if ($ENV{'form.screenshot.filename'}) {
578: $attachmentsize = length($ENV{'form.screenshot'});
579: if ($attachmentsize > 131072) {
580: $displaymsg .= "<br />The uploaded screenshot file ($attachmentsize bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded.";
581: } else {
582: $attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests');
583: }
584: }
585: }
586:
587: if ($attachmentpath =~ m-/([^/]+)$-) {
588: $fname = $1;
589: $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'}";
590: $supportmsg .= "\n";
591: foreach (@envvars) {
592: $supportmsg .= "$_: $ENV{$_}\n";
593: }
594: }
595:
596: my $msg = MIME::Lite->new(
597: From => $from,
598: To => $to,
599: Subject => $subject,
600: Type =>'TEXT',
601: Data => $supportmsg,
602: );
603:
604: if ($attachmentpath) {
605: my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);
606: $msg->attach(Type => $type,
607: Path => $attachmentpath,
608: Filename => $fname
609: );
610:
611: } else {
612: my $envdata = '';
613: foreach (@envvars) {
614: $envdata .= "$_: $ENV{$_}\n";
615: }
616: foreach (@loncvars) {
617: $envdata .= "$_: $ENV{$_}\n";
618: }
619: $msg->attach(Type => 'TEXT',
620: Data => $envdata);
621: }
622:
623: ### Send it:
624: # ->send can cause an sh launch which can pass all of %ENV along
1.4 albertel 625: # which can be to large for /bin/sh's little mind
626: my %oldENV=%ENV;
627: undef(%ENV);
1.5 raeburn 628: $msg->send('sendmail');
1.4 albertel 629: %ENV=%oldENV;
630: undef(%oldENV);
1.5 raeburn 631:
632: if ($attachmentpath =~ m#$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+#) {
633: unlink($attachmentpath);
634: }
635: $r->print(qq|
1.1 raeburn 636: <b>Your support request contained the following information</b>:<br /><br />
637: <table width="580" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
638: <tr>
639: <td>
640: <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
641: <tr>
642: <td>
643: <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
644: <tr>
645: <td>
646: <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">
647: <tr>
648: <td width="140" bgcolor="$tablecolor">
649: <table width="140" border="0" cellpadding="8" cellspacing="0">
650: <tr>
651: <td align="right"><b>Information supplied</b>
652: </td>
653: </tr>
654: </table>
655: </td>
656: <td width="100%" valign="top">
657: <table width="100%" border="0" cellpadding="8" cellspacing="0">
658: <tr>
1.5 raeburn 659: <td>$displaymsg</td>
1.1 raeburn 660: </tr>
661: </table>
662: </td>
663: </tr>
664: <tr>
1.5 raeburn 665: <td width="100%" colspan="2" bgcolor="#000000">
666: <img src="/adm/lonMisc/blackdot.gif" /><br />
667: </td>
668: </tr>
669: <tr>
670: <td width="140" bgcolor="$tablecolor">
671: <table width="140" border="0" cellpadding="8" cellspacing="0">
1.1 raeburn 672: <tr>
673: <td align="right"><b>Additional information recorded</b>
674: </td>
675: </tr>
676: </table>
677: </td>
678: <td width="100%" valign="top">
679: <table width="100%" border="0" cellpadding="8" cellspacing="0">
680: <tr>
681: <td>
1.5 raeburn 682: |);
1.1 raeburn 683: foreach (@envvars) {
1.5 raeburn 684: unless($ENV{$_} eq '') {
685: $r->print("$_: <font color='$vlinkcolor'>$ENV{$_}</font>, ");
686: }
1.1 raeburn 687: }
688: $r->print("
689: </td>
690: </tr>
691: </table>
692: </td>
693: </tr>
694: </table>
695: </td>
696: </tr>
697: </table>
698: </td>
699: </tr>
700: </table>
701: </td>
702: </tr>
703: </table>
704: ");
705: }
706:
707: sub retrieve_instcodes {
708: my ($coursecodes,$codedom,$totcodes) = @_;
709: my %courses = &Apache::lonnet::courseiddump($codedom,'.',1);
710: foreach my $course (keys %courses) {
711: if ($courses{$course} =~ m/^[^:]*:([^:]+)$/) {
712: $$coursecodes{$course} = &Apache::lonnet::unescape($1);
713: $totcodes ++;
714: }
715: }
716: return $totcodes;
717: }
718:
1.6 ! raeburn 719: sub build_code_selections {
! 720: my ($codes,$codetitles,$cat_titles,$cat_order,$idlist,$idnums,$idlist_titles) = @_;
! 721: my %idarrays = ();
! 722: for (my $i=1; $i<@{$codetitles}; $i++) {
! 723: %{$idarrays{$$codetitles[$i]}} = ();
! 724: }
! 725: foreach my $cid (sort keys %{$codes}) {
! 726: &recurse_list($cid,$codetitles,$codes,0,\%idarrays);
! 727: }
! 728: for (my $num=0; $num<@{$codetitles}; $num++) {
! 729: if ($num == 0) {
! 730: my @contents = ();
! 731: my @contents_titles = ();
! 732: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[0]}},\@contents);
! 733: if (defined($$cat_titles{$$codetitles[0]})) {
! 734: foreach (@contents) {
! 735: push @contents_titles, $$cat_titles{$$codetitles[0]}{$_};
! 736: }
! 737: }
! 738: $$idlist{$$codetitles[0]} = join('","',@contents);
! 739: $$idnums{$$codetitles[0]} = scalar(@contents);
! 740: print STDERR "idnums for {$$codetitles[0] is $$idnums{$$codetitles[0]}\n";
! 741: if (defined($$cat_titles{$$codetitles[0]})) {
! 742: $$idlist_titles{$$codetitles[0]} = join('","',@contents_titles);
! 743: }
! 744: } elsif ($num == 1) {
! 745: %{$$idlist{$$codetitles[1]}} = ();
! 746: %{$$idlist_titles{$$codetitles[1]}} = ();
! 747: foreach my $key_a (keys %{$idarrays{$$codetitles[1]}}) {
! 748: my @sorted_a = ();
! 749: my @sorted_a_titles = ();
! 750: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[1]}{$key_a}},\@sorted_a);
! 751: if (defined($$cat_titles{$$codetitles[1]})) {
! 752: foreach (@sorted_a) {
! 753: push @sorted_a_titles, $$cat_titles{$$codetitles[1]}{$_};
! 754: }
! 755: }
! 756: $$idlist{$$codetitles[1]}{$key_a} = join('","',@sorted_a);
! 757: $$idnums{$$codetitles[1]}{$key_a} = scalar(@sorted_a);
! 758: print STDERR "idnums for {$$codetitles[1] and $key_a is $$idnums{$$codetitles[1]}{$key_a}\n";
! 759: if (defined($$cat_titles{$$codetitles[1]})) {
! 760: $$idlist_titles{$$codetitles[1]}{$key_a} = join('","',@sorted_a_titles);
! 761: }
! 762: }
! 763: } elsif ($num == 2) {
! 764: %{$$idlist{$$codetitles[2]}} = ();
! 765: %{$$idlist_titles{$$codetitles[2]}} = ();
! 766: foreach my $key_a (keys %{$idarrays{$$codetitles[2]}}) {
! 767: %{$$idlist{$$codetitles[2]}{$key_a}} = ();
! 768: %{$$idlist_titles{$$codetitles[2]}{$key_a}} = ();
! 769: foreach my $key_b (keys %{$idarrays{$$codetitles[2]}{$key_a}}) {
! 770: my @sorted_b = ();
! 771: my @sorted_b_titles = ();
! 772: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[2]}{$key_a}{$key_b}},\@sorted_b);
! 773: if (defined($$cat_titles{$$codetitles[1]})) {
! 774: foreach (@sorted_b) {
! 775: push @sorted_b_titles, $$cat_titles{$$codetitles[1]}{$_};
! 776: }
! 777: }
! 778: $$idlist{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b);
! 779: $$idnums{$$codetitles[2]}{$key_a}{$key_b} = scalar(@sorted_b);
! 780: if (defined($$cat_titles{$$codetitles[2]})) {
! 781: $$idlist_titles{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b_titles);
! 782: }
! 783: }
! 784: }
! 785: } elsif ($num == 3) {
! 786: %{$$idlist{$$codetitles[3]}} = ();
! 787: foreach my $key_a (keys %{$idarrays{$$codetitles[3]}}) {
! 788: %{$$idlist{$$codetitles[3]}{$key_a}} = ();
! 789: foreach my $key_b (keys %{$idarrays{$$codetitles[3]}{$key_a}}) {
! 790: %{$$idlist{$$codetitles[3]}{$key_a}{$key_b}} = ();
! 791: foreach my $key_c (keys %{$idarrays{$$codetitles[3]}{$key_a}{$key_b}}) {
! 792: my @sorted_c = ();
! 793: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[3]}{$key_a}{$key_b}{$key_c}},\@sorted_c);
! 794: $$idlist{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = join('","',@sorted_c);
! 795: $$idnums{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = scalar(@sorted_c);
! 796: }
! 797: }
! 798: }
! 799: } elsif ($num == 4) {
! 800: %{$$idlist{$$codetitles[4]}} = ();
! 801: foreach my $key_a (keys %{$idarrays{$$codetitles[4]}}) {
! 802: %{$$idlist{$$codetitles[4]}{$key_a}} = ();
! 803: foreach my $key_b (keys %{$idarrays{$$codetitles[4]}{$key_a}}) {
! 804: %{$$idlist{$$codetitles[4]}{$key_a}{$key_b}} = ();
! 805: foreach my $key_c (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}}) {
! 806: %{$$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}} = ();
! 807: foreach my $key_d (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}}) {
! 808: my @sorted_d = ();
! 809: &sort_cats($num,$cat_order,$codetitles,$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d},\@sorted_d);
! 810: $$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = join('","',@sorted_d);
! 811: $$idnums{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = scalar(@sorted_d);
! 812: }
! 813: }
! 814: }
! 815: }
! 816: }
! 817: }
! 818: }
! 819:
! 820: sub sort_cats {
! 821: my ($num,$cat_order,$codetitles,$idsarrayref,$sorted) = @_;
! 822: my @unsorted = @{$idsarrayref};
! 823: if (defined($$cat_order{$$codetitles[$num]})) {
! 824: foreach (@{$$cat_order{$$codetitles[$num]}}) {
! 825: if (grep/^$_$/,@unsorted) {
! 826: push @{$sorted}, $_;
! 827: }
! 828: }
! 829: } else {
! 830: @{$sorted} = sort (@unsorted);
! 831: }
! 832: }
! 833:
! 834:
! 835: sub recurse_list {
! 836: my ($cid,$codetitles,$codes,$num,$idarrays) = @_;
! 837: if ($num == 0) {
! 838: if (!grep/^$$codes{$cid}{$$codetitles[0]}$/,@{$$idarrays{$$codetitles[0]}}) {
! 839: push @{$$idarrays{$$codetitles[0]}}, $$codes{$cid}{$$codetitles[0]};
! 840: print STDERR "Adding $$codes{$cid}{$$codetitles[0]} to $$codetitles[0]\n";
! 841: }
! 842: } elsif ($num == 1) {
! 843: if (defined($$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}})) {
! 844: if (!grep/^$$codes{$cid}{$$codetitles[1]}$/,@{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}}) {
! 845: push @{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}}, $$codes{$cid}{$$codetitles[1]};
! 846: }
! 847: } else {
! 848: @{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}} = ("$$codes{$cid}{$$codetitles[1]}");
! 849: }
! 850: } elsif ($num == 2) {
! 851: if (defined($$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}})) {
! 852: if (defined($$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
! 853: if (!grep/^$$codes{$cid}{$$codetitles[2]}$/,@{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}}) {
! 854: push @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}}, $$codes{$cid}{$$codetitles[2]};
! 855: }
! 856: } else {
! 857: @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ("$$codes{$cid}{$$codetitles[2]}");
! 858: }
! 859: } else {
! 860: %{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}} = ();
! 861: @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ("$$codes{$cid}{$$codetitles[2]}");
! 862: }
! 863: } elsif ($num == 3) {
! 864: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}})) {
! 865: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
! 866: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}})) {
! 867: if (!grep/^$$codes{$cid}{$$codetitles[3]}$/,@{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}}) {
! 868: push @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}}, $$codes{$cid}{$$codetitles[3]};
! 869: }
! 870: } else {
! 871: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
! 872: }
! 873: } else {
! 874: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
! 875: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
! 876: }
! 877: } else {
! 878: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}} = ();
! 879: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
! 880: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
! 881: }
! 882: } elsif ($num == 4) {
! 883: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}})) {
! 884: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
! 885: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}})) {
! 886: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}})) {
! 887: if (!grep/^$$codes{$cid}{$$codetitles[4]}$/,@{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}}) {
! 888: push @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}}, $$codes{$cid}{$$codetitles[4]};
! 889: }
! 890: } else {
! 891: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
! 892: }
! 893: } else {
! 894: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
! 895: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
! 896: }
! 897: } else {
! 898: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
! 899: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
! 900: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
! 901: }
! 902: } else {
! 903: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}} = ();
! 904: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
! 905: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
! 906: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[3]}");
! 907: }
! 908: }
! 909: $num ++;
! 910: if ($num <@{$codetitles}) {
! 911: &recurse_list($cid,$codetitles,$codes,$num,$idarrays);
! 912: }
! 913: }
! 914:
! 915: sub javascript_code_selections {
! 916: my ($numcats,$script_tag,$idlist,$idnums,$idlist_titles,$codetitles) = @_;
! 917: $$script_tag .= <<END;
! 918: function courseSet(caller) {
! 919: var idyr = document.forms.logproblem.idyear.selectedIndex
! 920: var idsem = document.forms.logproblem.idsem.selectedIndex
! 921: var iddept = document.forms.logproblem.iddept.selectedIndex
! 922: var idclass = document.forms.logproblem.idclass.selectedIndex
! 923: var idyears = new Array("$$idlist{$$codetitles[0]}");
! 924: var idsems = new Array ($$idnums{$$codetitles[0]});
! 925: var idsemlongs = new Array ($$idnums{$$codetitles[0]});
! 926: var idcodes = new Array ($$idnums{$$codetitles[0]});
! 927: var idcourses = new Array ($$idnums{$$codetitles[0]});
! 928: var idsections = new Array ($$idnums{$$codetitles[0]})
! 929: END
! 930: my @sort_a = split/","/,$$idlist{$$codetitles[0]};
! 931: for (my $j=0; $j<@sort_a; $j++) {
! 932: $$script_tag .= qq| idsems[$j] = new Array("$$idlist{$$codetitles[1]}{$sort_a[$j]}")\n|;
! 933: $$script_tag .= qq| idsemlongs[$j] = new Array("$$idlist_titles{$$codetitles[1]}{$sort_a[$j]}")\n|;
! 934: $$script_tag .= qq| idcodes[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|;
! 935: $$script_tag .= qq| idcourses[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|;
! 936: $$script_tag .= qq| idsections[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|;
! 937: my @sort_b = split/","/,$$idlist{$$codetitles[1]}{$sort_a[$j]};
! 938: for (my $k=0; $k<@sort_b; $k++) {
! 939: my $idcode_entry = $$idlist{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]};
! 940: $$script_tag .= qq| idcodes[$j][$k] = new Array("$idcode_entry")\n|;
! 941: $$script_tag .= qq| idcourses[$j][$k] = new Array($$idnums{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]})\n|;
! 942: $$script_tag .= qq| idsections[$j][$k] = new Array($$idnums{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]})\n|;
! 943: my @sort_c = split/","/,$$idlist{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]};
! 944: for (my $l=0; $l<@sort_c; $l++) {
! 945: my $idcourse_entry = $$idlist{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]};
! 946: $$script_tag .= qq| idcourses[$j][$k][$l] = new Array("$idcourse_entry")\n|;
! 947: $$script_tag .= qq| idsections[$j][$k][$l] = new Array($$idnums{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]})\n|;
! 948: my @sort_d = split/","/,$$idlist{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]};
! 949: for (my $m=0; $m<@sort_d; $m++) {
! 950: my $idsecentry = $$idlist{$$codetitles[4]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]}{$sort_d[$m]};
! 951: $$script_tag .= qq| idsections[$j][$k][$l][$m] = new Array("$idsecentry")\n|;
! 952: }
! 953: }
! 954: }
! 955: }
! 956: $$script_tag .= (<<END_OF_BLOCK);
! 957: if (caller == "semester") {
! 958: document.forms.logproblem.iddept.length = 0
! 959: document.forms.logproblem.idclass.length = 0
! 960: document.forms.logproblem.idsec.length = 0
! 961: document.forms.logproblem.iddept.options[0] = new Option("<-Pick sem.","-1",true,true)
! 962: document.forms.logproblem.idclass.options[0] = new Option("<-Pick dept.","-1",true,true)
! 963: document.forms.logproblem.idsec.options[0] = new Option("Pick course first (above)","-1",true,true)
! 964: if (idyr == 0) {
! 965: document.forms.logproblem.idsem.length = 0
! 966: document.forms.logproblem.idsem.options[0] = new Option("<-Pick year","-1",true,true)
! 967: }
! 968: else {
! 969: document.forms.logproblem.idsem.length = 0
! 970: document.forms.logproblem.idsem.options[0] = new Option("Select","-1",true,true)
! 971: for (var i=0; i<idsems[idyr-1].length; i++) {
! 972: document.forms.logproblem.idsem.options[i+1] = new Option(idsemlongs[idyr-1][i],idsems[idyr-1][i],false,false)
! 973: }
! 974: }
! 975: document.forms.logproblem.idsem.selectedIndex = 0;
! 976: }
! 977: if (caller == "dept") {
! 978: document.forms.logproblem.iddept.length = 0
! 979: document.forms.logproblem.idclass.length = 0
! 980: document.forms.logproblem.idsec.length = 0
! 981: document.forms.logproblem.idclass.options[0] = new Option("<-Pick dept.","-1",true,true)
! 982: document.forms.logproblem.idsec.options[0] = new Option("Pick course first (above)","-1",true,true)
! 983: if (idsem == 0) {
! 984: document.forms.logproblem.iddept.options[0] = new Option("<-Pick sem.","-1",true,true)
! 985: document.forms.logproblem.iddept.options[0] = new Option("<-Pick sem.","-1",true,true)
! 986: }
! 987: else {
! 988: document.forms.logproblem.iddept.options[0] = new Option("Select","-1",true,true)
! 989: for (var i=0; i<idcodes[idyr-1][idsem-1].length; i++) {
! 990: document.forms.logproblem.iddept.options[i+1] = new Option(idcodes[idyr-1][idsem-1][i],idcodes[idyr-1][idsem-1][i],false,false)
! 991: }
! 992: }
! 993: document.forms.logproblem.iddept.selectedIndex = 0
! 994: }
! 995: if (caller == "course") {
! 996: document.forms.logproblem.idclass.length = 0
! 997: document.forms.logproblem.idsec.length = 0
! 998: document.forms.logproblem.idsec.options[0] = new Option("Pick course first (above)","-1",true,true)
! 999: if (iddept == 0) {
! 1000: document.forms.logproblem.idclass.options[0] = new Option("<-Pick dept.","-1",true,true)
! 1001: }
! 1002: else {
! 1003: document.forms.logproblem.idclass.options[0] = new Option("Select","-1",true,true)
! 1004: for (var i=0; i<idcourses[idyr-1][idsem-1][iddept-1].length; i++) {
! 1005: document.forms.logproblem.idclass.options[i+1] = new Option(idcourses[idyr-1][idsem-1][iddept-1][i],idcourses[idyr-1][idsem-1][iddept-1][i],false,false)
! 1006: }
! 1007: }
! 1008: document.forms.logproblem.idclass.selectedIndex = 0
! 1009: }
! 1010: }
! 1011: END_OF_BLOCK
! 1012: }
! 1013:
1.1 raeburn 1014: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>