Annotation of loncom/interface/lonsupportreq.pm, revision 1.7
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: if (defined($$cat_titles{$$codetitles[0]})) {
741: $$idlist_titles{$$codetitles[0]} = join('","',@contents_titles);
742: }
743: } elsif ($num == 1) {
744: %{$$idlist{$$codetitles[1]}} = ();
745: %{$$idlist_titles{$$codetitles[1]}} = ();
746: foreach my $key_a (keys %{$idarrays{$$codetitles[1]}}) {
747: my @sorted_a = ();
748: my @sorted_a_titles = ();
749: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[1]}{$key_a}},\@sorted_a);
750: if (defined($$cat_titles{$$codetitles[1]})) {
751: foreach (@sorted_a) {
752: push @sorted_a_titles, $$cat_titles{$$codetitles[1]}{$_};
753: }
754: }
755: $$idlist{$$codetitles[1]}{$key_a} = join('","',@sorted_a);
756: $$idnums{$$codetitles[1]}{$key_a} = scalar(@sorted_a);
757: if (defined($$cat_titles{$$codetitles[1]})) {
758: $$idlist_titles{$$codetitles[1]}{$key_a} = join('","',@sorted_a_titles);
759: }
760: }
761: } elsif ($num == 2) {
762: %{$$idlist{$$codetitles[2]}} = ();
763: %{$$idlist_titles{$$codetitles[2]}} = ();
764: foreach my $key_a (keys %{$idarrays{$$codetitles[2]}}) {
765: %{$$idlist{$$codetitles[2]}{$key_a}} = ();
766: %{$$idlist_titles{$$codetitles[2]}{$key_a}} = ();
767: foreach my $key_b (keys %{$idarrays{$$codetitles[2]}{$key_a}}) {
768: my @sorted_b = ();
769: my @sorted_b_titles = ();
770: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[2]}{$key_a}{$key_b}},\@sorted_b);
771: if (defined($$cat_titles{$$codetitles[1]})) {
772: foreach (@sorted_b) {
773: push @sorted_b_titles, $$cat_titles{$$codetitles[1]}{$_};
774: }
775: }
776: $$idlist{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b);
777: $$idnums{$$codetitles[2]}{$key_a}{$key_b} = scalar(@sorted_b);
778: if (defined($$cat_titles{$$codetitles[2]})) {
779: $$idlist_titles{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b_titles);
780: }
781: }
782: }
783: } elsif ($num == 3) {
784: %{$$idlist{$$codetitles[3]}} = ();
785: foreach my $key_a (keys %{$idarrays{$$codetitles[3]}}) {
786: %{$$idlist{$$codetitles[3]}{$key_a}} = ();
787: foreach my $key_b (keys %{$idarrays{$$codetitles[3]}{$key_a}}) {
788: %{$$idlist{$$codetitles[3]}{$key_a}{$key_b}} = ();
789: foreach my $key_c (keys %{$idarrays{$$codetitles[3]}{$key_a}{$key_b}}) {
790: my @sorted_c = ();
791: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[3]}{$key_a}{$key_b}{$key_c}},\@sorted_c);
792: $$idlist{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = join('","',@sorted_c);
793: $$idnums{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = scalar(@sorted_c);
794: }
795: }
796: }
797: } elsif ($num == 4) {
798: %{$$idlist{$$codetitles[4]}} = ();
799: foreach my $key_a (keys %{$idarrays{$$codetitles[4]}}) {
800: %{$$idlist{$$codetitles[4]}{$key_a}} = ();
801: foreach my $key_b (keys %{$idarrays{$$codetitles[4]}{$key_a}}) {
802: %{$$idlist{$$codetitles[4]}{$key_a}{$key_b}} = ();
803: foreach my $key_c (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}}) {
804: %{$$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}} = ();
805: foreach my $key_d (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}}) {
806: my @sorted_d = ();
807: &sort_cats($num,$cat_order,$codetitles,$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d},\@sorted_d);
808: $$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = join('","',@sorted_d);
809: $$idnums{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = scalar(@sorted_d);
810: }
811: }
812: }
813: }
814: }
815: }
816: }
817:
818: sub sort_cats {
819: my ($num,$cat_order,$codetitles,$idsarrayref,$sorted) = @_;
820: my @unsorted = @{$idsarrayref};
821: if (defined($$cat_order{$$codetitles[$num]})) {
822: foreach (@{$$cat_order{$$codetitles[$num]}}) {
823: if (grep/^$_$/,@unsorted) {
824: push @{$sorted}, $_;
825: }
826: }
827: } else {
828: @{$sorted} = sort (@unsorted);
829: }
830: }
831:
832:
833: sub recurse_list {
834: my ($cid,$codetitles,$codes,$num,$idarrays) = @_;
835: if ($num == 0) {
836: if (!grep/^$$codes{$cid}{$$codetitles[0]}$/,@{$$idarrays{$$codetitles[0]}}) {
837: push @{$$idarrays{$$codetitles[0]}}, $$codes{$cid}{$$codetitles[0]};
838: }
839: } elsif ($num == 1) {
840: if (defined($$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}})) {
841: if (!grep/^$$codes{$cid}{$$codetitles[1]}$/,@{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}}) {
842: push @{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}}, $$codes{$cid}{$$codetitles[1]};
843: }
844: } else {
845: @{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}} = ("$$codes{$cid}{$$codetitles[1]}");
846: }
847: } elsif ($num == 2) {
848: if (defined($$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}})) {
849: if (defined($$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
850: if (!grep/^$$codes{$cid}{$$codetitles[2]}$/,@{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}}) {
851: push @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}}, $$codes{$cid}{$$codetitles[2]};
852: }
853: } else {
854: @{$$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]}}} = ();
858: @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ("$$codes{$cid}{$$codetitles[2]}");
859: }
860: } elsif ($num == 3) {
861: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}})) {
862: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
863: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}})) {
864: if (!grep/^$$codes{$cid}{$$codetitles[3]}$/,@{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}}) {
865: push @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}}, $$codes{$cid}{$$codetitles[3]};
866: }
867: } else {
868: @{$$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]}}} = ();
872: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
873: }
874: } else {
875: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}} = ();
876: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
877: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
878: }
879: } elsif ($num == 4) {
880: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}})) {
881: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
882: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}})) {
883: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}})) {
884: 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]}}}) {
885: push @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}}, $$codes{$cid}{$$codetitles[4]};
886: }
887: } else {
888: @{$$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]}}} = ();
892: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
893: }
894: } else {
895: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
896: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
897: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
898: }
899: } else {
900: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}} = ();
901: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
902: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
903: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[3]}");
904: }
905: }
906: $num ++;
907: if ($num <@{$codetitles}) {
908: &recurse_list($cid,$codetitles,$codes,$num,$idarrays);
909: }
910: }
911:
912: sub javascript_code_selections {
913: my ($numcats,$script_tag,$idlist,$idnums,$idlist_titles,$codetitles) = @_;
914: $$script_tag .= <<END;
915: function courseSet(caller) {
916: var idyr = document.forms.logproblem.idyear.selectedIndex
917: var idsem = document.forms.logproblem.idsem.selectedIndex
918: var iddept = document.forms.logproblem.iddept.selectedIndex
919: var idclass = document.forms.logproblem.idclass.selectedIndex
920: var idyears = new Array("$$idlist{$$codetitles[0]}");
921: var idsems = new Array ($$idnums{$$codetitles[0]});
922: var idsemlongs = new Array ($$idnums{$$codetitles[0]});
923: var idcodes = new Array ($$idnums{$$codetitles[0]});
924: var idcourses = new Array ($$idnums{$$codetitles[0]});
925: var idsections = new Array ($$idnums{$$codetitles[0]})
926: END
927: my @sort_a = split/","/,$$idlist{$$codetitles[0]};
928: for (my $j=0; $j<@sort_a; $j++) {
929: $$script_tag .= qq| idsems[$j] = new Array("$$idlist{$$codetitles[1]}{$sort_a[$j]}")\n|;
930: $$script_tag .= qq| idsemlongs[$j] = new Array("$$idlist_titles{$$codetitles[1]}{$sort_a[$j]}")\n|;
931: $$script_tag .= qq| idcodes[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|;
932: $$script_tag .= qq| idcourses[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|;
933: $$script_tag .= qq| idsections[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|;
934: my @sort_b = split/","/,$$idlist{$$codetitles[1]}{$sort_a[$j]};
935: for (my $k=0; $k<@sort_b; $k++) {
936: my $idcode_entry = $$idlist{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]};
937: $$script_tag .= qq| idcodes[$j][$k] = new Array("$idcode_entry")\n|;
938: $$script_tag .= qq| idcourses[$j][$k] = new Array($$idnums{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]})\n|;
939: $$script_tag .= qq| idsections[$j][$k] = new Array($$idnums{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]})\n|;
940: my @sort_c = split/","/,$$idlist{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]};
941: for (my $l=0; $l<@sort_c; $l++) {
942: my $idcourse_entry = $$idlist{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]};
943: $$script_tag .= qq| idcourses[$j][$k][$l] = new Array("$idcourse_entry")\n|;
944: $$script_tag .= qq| idsections[$j][$k][$l] = new Array($$idnums{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]})\n|;
945: my @sort_d = split/","/,$$idlist{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]};
946: for (my $m=0; $m<@sort_d; $m++) {
947: my $idsecentry = $$idlist{$$codetitles[4]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]}{$sort_d[$m]};
948: $$script_tag .= qq| idsections[$j][$k][$l][$m] = new Array("$idsecentry")\n|;
949: }
950: }
951: }
952: }
953: $$script_tag .= (<<END_OF_BLOCK);
954: if (caller == "semester") {
955: document.forms.logproblem.iddept.length = 0
956: document.forms.logproblem.idclass.length = 0
957: document.forms.logproblem.idsec.length = 0
958: document.forms.logproblem.iddept.options[0] = new Option("<-Pick sem.","-1",true,true)
959: document.forms.logproblem.idclass.options[0] = new Option("<-Pick dept.","-1",true,true)
960: document.forms.logproblem.idsec.options[0] = new Option("Pick course first (above)","-1",true,true)
961: if (idyr == 0) {
962: document.forms.logproblem.idsem.length = 0
963: document.forms.logproblem.idsem.options[0] = new Option("<-Pick year","-1",true,true)
964: }
965: else {
966: document.forms.logproblem.idsem.length = 0
967: document.forms.logproblem.idsem.options[0] = new Option("Select","-1",true,true)
968: for (var i=0; i<idsems[idyr-1].length; i++) {
969: document.forms.logproblem.idsem.options[i+1] = new Option(idsemlongs[idyr-1][i],idsems[idyr-1][i],false,false)
970: }
971: }
972: document.forms.logproblem.idsem.selectedIndex = 0;
973: }
974: if (caller == "dept") {
975: document.forms.logproblem.iddept.length = 0
976: document.forms.logproblem.idclass.length = 0
977: document.forms.logproblem.idsec.length = 0
978: document.forms.logproblem.idclass.options[0] = new Option("<-Pick dept.","-1",true,true)
979: document.forms.logproblem.idsec.options[0] = new Option("Pick course first (above)","-1",true,true)
980: if (idsem == 0) {
981: document.forms.logproblem.iddept.options[0] = new Option("<-Pick sem.","-1",true,true)
982: document.forms.logproblem.iddept.options[0] = new Option("<-Pick sem.","-1",true,true)
983: }
984: else {
985: document.forms.logproblem.iddept.options[0] = new Option("Select","-1",true,true)
986: for (var i=0; i<idcodes[idyr-1][idsem-1].length; i++) {
987: document.forms.logproblem.iddept.options[i+1] = new Option(idcodes[idyr-1][idsem-1][i],idcodes[idyr-1][idsem-1][i],false,false)
988: }
989: }
990: document.forms.logproblem.iddept.selectedIndex = 0
991: }
992: if (caller == "course") {
993: document.forms.logproblem.idclass.length = 0
994: document.forms.logproblem.idsec.length = 0
995: document.forms.logproblem.idsec.options[0] = new Option("Pick course first (above)","-1",true,true)
996: if (iddept == 0) {
997: document.forms.logproblem.idclass.options[0] = new Option("<-Pick dept.","-1",true,true)
998: }
999: else {
1000: document.forms.logproblem.idclass.options[0] = new Option("Select","-1",true,true)
1001: for (var i=0; i<idcourses[idyr-1][idsem-1][iddept-1].length; i++) {
1002: 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)
1003: }
1004: }
1005: document.forms.logproblem.idclass.selectedIndex = 0
1006: }
1007: }
1008: END_OF_BLOCK
1009: }
1010:
1.1 raeburn 1011: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>