Annotation of loncom/interface/lonsupportreq.pm, revision 1.9
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
1.9 ! raeburn 547: } else {
! 548: $to = $admin;
! 549: if ($to =~ m/^[^\@]+\@[^\@]+$/) {
! 550: $r->print(<<END);
! 551: <html>
! 552: <head>
! 553: <title>LON-CAPA support request recorded</title>
! 554: </head>
! 555: $bodytag
! 556: <h3>A support request has been sent to $to</h3>
! 557: END
! 558: } else {
! 559: $r->print(<<END);
1.1 raeburn 560: <html>
561: <head>
562: <title>LON-CAPA support request recorded</title>
563: </head>
564: $bodytag
565: <h3>Warning: Problem with support e-mail address</h3>
1.9 ! raeburn 566: 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.
1.1 raeburn 567: END
1.9 ! raeburn 568: $to = 'helpdesk@lon-capa.org';
! 569: }
1.1 raeburn 570: }
1.5 raeburn 571: if (defined($ENV{'form.email'})) {
572: if ($ENV{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) {
573: $from = $ENV{'form.email'};
574: }
575: }
576:
577: my $subject = $ENV{'form.subject'};
578: $subject =~ s#(`)#'#g;
579: $subject =~ s#\$#\(\$\)#g;
580: $supportmsg =~ s#(`)#'#g;
581: $supportmsg =~ s#\$#\(\$\)#g;
582: $displaymsg =~ s#(`)#'#g;
583: $displaymsg =~ s#\$#\(\$\)#g;
584: my $fname;
585:
586: my $attachmentpath = '';
587: my $attachmentsize = '';
588: if (defined($ENV{'user.name'})) {
589: if ($ENV{'form.screenshot.filename'}) {
590: $attachmentsize = length($ENV{'form.screenshot'});
591: if ($attachmentsize > 131072) {
592: $displaymsg .= "<br />The uploaded screenshot file ($attachmentsize bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded.";
593: } else {
594: $attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests');
595: }
596: }
597: }
598:
599: if ($attachmentpath =~ m-/([^/]+)$-) {
600: $fname = $1;
601: $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'}";
602: $supportmsg .= "\n";
603: foreach (@envvars) {
604: $supportmsg .= "$_: $ENV{$_}\n";
605: }
606: }
607:
608: my $msg = MIME::Lite->new(
609: From => $from,
610: To => $to,
611: Subject => $subject,
612: Type =>'TEXT',
613: Data => $supportmsg,
614: );
615:
616: if ($attachmentpath) {
617: my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);
618: $msg->attach(Type => $type,
619: Path => $attachmentpath,
620: Filename => $fname
621: );
622:
623: } else {
624: my $envdata = '';
625: foreach (@envvars) {
626: $envdata .= "$_: $ENV{$_}\n";
627: }
628: foreach (@loncvars) {
629: $envdata .= "$_: $ENV{$_}\n";
630: }
631: $msg->attach(Type => 'TEXT',
632: Data => $envdata);
633: }
634:
635: ### Send it:
636: # ->send can cause an sh launch which can pass all of %ENV along
1.4 albertel 637: # which can be to large for /bin/sh's little mind
638: my %oldENV=%ENV;
639: undef(%ENV);
1.5 raeburn 640: $msg->send('sendmail');
1.4 albertel 641: %ENV=%oldENV;
642: undef(%oldENV);
1.5 raeburn 643:
644: if ($attachmentpath =~ m#$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+#) {
645: unlink($attachmentpath);
646: }
647: $r->print(qq|
1.1 raeburn 648: <b>Your support request contained the following information</b>:<br /><br />
649: <table width="580" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
650: <tr>
651: <td>
652: <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
653: <tr>
654: <td>
655: <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
656: <tr>
657: <td>
658: <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">
659: <tr>
660: <td width="140" bgcolor="$tablecolor">
661: <table width="140" border="0" cellpadding="8" cellspacing="0">
662: <tr>
663: <td align="right"><b>Information supplied</b>
664: </td>
665: </tr>
666: </table>
667: </td>
668: <td width="100%" valign="top">
669: <table width="100%" border="0" cellpadding="8" cellspacing="0">
670: <tr>
1.5 raeburn 671: <td>$displaymsg</td>
1.1 raeburn 672: </tr>
673: </table>
674: </td>
675: </tr>
676: <tr>
1.5 raeburn 677: <td width="100%" colspan="2" bgcolor="#000000">
678: <img src="/adm/lonMisc/blackdot.gif" /><br />
679: </td>
680: </tr>
681: <tr>
682: <td width="140" bgcolor="$tablecolor">
683: <table width="140" border="0" cellpadding="8" cellspacing="0">
1.1 raeburn 684: <tr>
685: <td align="right"><b>Additional information recorded</b>
686: </td>
687: </tr>
688: </table>
689: </td>
690: <td width="100%" valign="top">
691: <table width="100%" border="0" cellpadding="8" cellspacing="0">
692: <tr>
693: <td>
1.5 raeburn 694: |);
1.1 raeburn 695: foreach (@envvars) {
1.5 raeburn 696: unless($ENV{$_} eq '') {
697: $r->print("$_: <font color='$vlinkcolor'>$ENV{$_}</font>, ");
698: }
1.1 raeburn 699: }
700: $r->print("
701: </td>
702: </tr>
703: </table>
704: </td>
705: </tr>
706: </table>
707: </td>
708: </tr>
709: </table>
710: </td>
711: </tr>
712: </table>
713: </td>
714: </tr>
715: </table>
716: ");
717: }
718:
719: sub retrieve_instcodes {
720: my ($coursecodes,$codedom,$totcodes) = @_;
721: my %courses = &Apache::lonnet::courseiddump($codedom,'.',1);
722: foreach my $course (keys %courses) {
723: if ($courses{$course} =~ m/^[^:]*:([^:]+)$/) {
724: $$coursecodes{$course} = &Apache::lonnet::unescape($1);
725: $totcodes ++;
726: }
727: }
728: return $totcodes;
729: }
730:
1.6 raeburn 731: sub build_code_selections {
732: my ($codes,$codetitles,$cat_titles,$cat_order,$idlist,$idnums,$idlist_titles) = @_;
733: my %idarrays = ();
734: for (my $i=1; $i<@{$codetitles}; $i++) {
735: %{$idarrays{$$codetitles[$i]}} = ();
736: }
737: foreach my $cid (sort keys %{$codes}) {
738: &recurse_list($cid,$codetitles,$codes,0,\%idarrays);
739: }
740: for (my $num=0; $num<@{$codetitles}; $num++) {
741: if ($num == 0) {
742: my @contents = ();
743: my @contents_titles = ();
744: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[0]}},\@contents);
745: if (defined($$cat_titles{$$codetitles[0]})) {
746: foreach (@contents) {
747: push @contents_titles, $$cat_titles{$$codetitles[0]}{$_};
748: }
749: }
750: $$idlist{$$codetitles[0]} = join('","',@contents);
751: $$idnums{$$codetitles[0]} = scalar(@contents);
752: if (defined($$cat_titles{$$codetitles[0]})) {
753: $$idlist_titles{$$codetitles[0]} = join('","',@contents_titles);
754: }
755: } elsif ($num == 1) {
756: %{$$idlist{$$codetitles[1]}} = ();
757: %{$$idlist_titles{$$codetitles[1]}} = ();
758: foreach my $key_a (keys %{$idarrays{$$codetitles[1]}}) {
759: my @sorted_a = ();
760: my @sorted_a_titles = ();
761: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[1]}{$key_a}},\@sorted_a);
762: if (defined($$cat_titles{$$codetitles[1]})) {
763: foreach (@sorted_a) {
764: push @sorted_a_titles, $$cat_titles{$$codetitles[1]}{$_};
765: }
766: }
767: $$idlist{$$codetitles[1]}{$key_a} = join('","',@sorted_a);
768: $$idnums{$$codetitles[1]}{$key_a} = scalar(@sorted_a);
769: if (defined($$cat_titles{$$codetitles[1]})) {
770: $$idlist_titles{$$codetitles[1]}{$key_a} = join('","',@sorted_a_titles);
771: }
772: }
773: } elsif ($num == 2) {
774: %{$$idlist{$$codetitles[2]}} = ();
775: %{$$idlist_titles{$$codetitles[2]}} = ();
776: foreach my $key_a (keys %{$idarrays{$$codetitles[2]}}) {
777: %{$$idlist{$$codetitles[2]}{$key_a}} = ();
778: %{$$idlist_titles{$$codetitles[2]}{$key_a}} = ();
779: foreach my $key_b (keys %{$idarrays{$$codetitles[2]}{$key_a}}) {
780: my @sorted_b = ();
781: my @sorted_b_titles = ();
782: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[2]}{$key_a}{$key_b}},\@sorted_b);
783: if (defined($$cat_titles{$$codetitles[1]})) {
784: foreach (@sorted_b) {
785: push @sorted_b_titles, $$cat_titles{$$codetitles[1]}{$_};
786: }
787: }
788: $$idlist{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b);
789: $$idnums{$$codetitles[2]}{$key_a}{$key_b} = scalar(@sorted_b);
790: if (defined($$cat_titles{$$codetitles[2]})) {
791: $$idlist_titles{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b_titles);
792: }
793: }
794: }
795: } elsif ($num == 3) {
796: %{$$idlist{$$codetitles[3]}} = ();
797: foreach my $key_a (keys %{$idarrays{$$codetitles[3]}}) {
798: %{$$idlist{$$codetitles[3]}{$key_a}} = ();
799: foreach my $key_b (keys %{$idarrays{$$codetitles[3]}{$key_a}}) {
800: %{$$idlist{$$codetitles[3]}{$key_a}{$key_b}} = ();
801: foreach my $key_c (keys %{$idarrays{$$codetitles[3]}{$key_a}{$key_b}}) {
802: my @sorted_c = ();
803: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[3]}{$key_a}{$key_b}{$key_c}},\@sorted_c);
804: $$idlist{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = join('","',@sorted_c);
805: $$idnums{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = scalar(@sorted_c);
806: }
807: }
808: }
809: } elsif ($num == 4) {
810: %{$$idlist{$$codetitles[4]}} = ();
811: foreach my $key_a (keys %{$idarrays{$$codetitles[4]}}) {
812: %{$$idlist{$$codetitles[4]}{$key_a}} = ();
813: foreach my $key_b (keys %{$idarrays{$$codetitles[4]}{$key_a}}) {
814: %{$$idlist{$$codetitles[4]}{$key_a}{$key_b}} = ();
815: foreach my $key_c (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}}) {
816: %{$$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}} = ();
817: foreach my $key_d (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}}) {
818: my @sorted_d = ();
819: &sort_cats($num,$cat_order,$codetitles,$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d},\@sorted_d);
820: $$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = join('","',@sorted_d);
821: $$idnums{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = scalar(@sorted_d);
822: }
823: }
824: }
825: }
826: }
827: }
828: }
829:
830: sub sort_cats {
831: my ($num,$cat_order,$codetitles,$idsarrayref,$sorted) = @_;
832: my @unsorted = @{$idsarrayref};
833: if (defined($$cat_order{$$codetitles[$num]})) {
834: foreach (@{$$cat_order{$$codetitles[$num]}}) {
835: if (grep/^$_$/,@unsorted) {
836: push @{$sorted}, $_;
837: }
838: }
839: } else {
840: @{$sorted} = sort (@unsorted);
841: }
842: }
843:
844:
845: sub recurse_list {
846: my ($cid,$codetitles,$codes,$num,$idarrays) = @_;
847: if ($num == 0) {
848: if (!grep/^$$codes{$cid}{$$codetitles[0]}$/,@{$$idarrays{$$codetitles[0]}}) {
849: push @{$$idarrays{$$codetitles[0]}}, $$codes{$cid}{$$codetitles[0]};
850: }
851: } elsif ($num == 1) {
852: if (defined($$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}})) {
853: if (!grep/^$$codes{$cid}{$$codetitles[1]}$/,@{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}}) {
854: push @{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}}, $$codes{$cid}{$$codetitles[1]};
855: }
856: } else {
857: @{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}} = ("$$codes{$cid}{$$codetitles[1]}");
858: }
859: } elsif ($num == 2) {
860: if (defined($$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}})) {
861: if (defined($$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
862: if (!grep/^$$codes{$cid}{$$codetitles[2]}$/,@{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}}) {
863: push @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}}, $$codes{$cid}{$$codetitles[2]};
864: }
865: } else {
866: @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ("$$codes{$cid}{$$codetitles[2]}");
867: }
868: } else {
869: %{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}} = ();
870: @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ("$$codes{$cid}{$$codetitles[2]}");
871: }
872: } elsif ($num == 3) {
873: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}})) {
874: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
875: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}})) {
876: if (!grep/^$$codes{$cid}{$$codetitles[3]}$/,@{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}}) {
877: push @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}}, $$codes{$cid}{$$codetitles[3]};
878: }
879: } else {
880: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
881: }
882: } else {
883: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
884: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
885: }
886: } else {
887: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}} = ();
888: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
889: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
890: }
891: } elsif ($num == 4) {
892: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}})) {
893: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
894: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}})) {
895: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}})) {
896: 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]}}}) {
897: push @{$$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]}}{$$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]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
904: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
905: }
906: } else {
907: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
908: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
909: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
910: }
911: } else {
912: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}} = ();
913: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
914: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
915: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[3]}");
916: }
917: }
918: $num ++;
919: if ($num <@{$codetitles}) {
920: &recurse_list($cid,$codetitles,$codes,$num,$idarrays);
921: }
922: }
923:
924: sub javascript_code_selections {
925: my ($numcats,$script_tag,$idlist,$idnums,$idlist_titles,$codetitles) = @_;
926: $$script_tag .= <<END;
927: function courseSet(caller) {
928: var idyr = document.forms.logproblem.idyear.selectedIndex
929: var idsem = document.forms.logproblem.idsem.selectedIndex
930: var iddept = document.forms.logproblem.iddept.selectedIndex
931: var idclass = document.forms.logproblem.idclass.selectedIndex
932: var idyears = new Array("$$idlist{$$codetitles[0]}");
933: var idsems = new Array ($$idnums{$$codetitles[0]});
934: var idsemlongs = new Array ($$idnums{$$codetitles[0]});
935: var idcodes = new Array ($$idnums{$$codetitles[0]});
936: var idcourses = new Array ($$idnums{$$codetitles[0]});
937: var idsections = new Array ($$idnums{$$codetitles[0]})
938: END
939: my @sort_a = split/","/,$$idlist{$$codetitles[0]};
940: for (my $j=0; $j<@sort_a; $j++) {
941: $$script_tag .= qq| idsems[$j] = new Array("$$idlist{$$codetitles[1]}{$sort_a[$j]}")\n|;
942: $$script_tag .= qq| idsemlongs[$j] = new Array("$$idlist_titles{$$codetitles[1]}{$sort_a[$j]}")\n|;
943: $$script_tag .= qq| idcodes[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|;
944: $$script_tag .= qq| idcourses[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|;
945: $$script_tag .= qq| idsections[$j] = new Array($$idnums{$$codetitles[1]}{$sort_a[$j]})\n|;
946: my @sort_b = split/","/,$$idlist{$$codetitles[1]}{$sort_a[$j]};
947: for (my $k=0; $k<@sort_b; $k++) {
948: my $idcode_entry = $$idlist{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]};
949: $$script_tag .= qq| idcodes[$j][$k] = new Array("$idcode_entry")\n|;
950: $$script_tag .= qq| idcourses[$j][$k] = new Array($$idnums{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]})\n|;
951: $$script_tag .= qq| idsections[$j][$k] = new Array($$idnums{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]})\n|;
952: my @sort_c = split/","/,$$idlist{$$codetitles[2]}{$sort_a[$j]}{$sort_b[$k]};
953: for (my $l=0; $l<@sort_c; $l++) {
954: my $idcourse_entry = $$idlist{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]};
955: $$script_tag .= qq| idcourses[$j][$k][$l] = new Array("$idcourse_entry")\n|;
956: $$script_tag .= qq| idsections[$j][$k][$l] = new Array($$idnums{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]})\n|;
957: my @sort_d = split/","/,$$idlist{$$codetitles[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]};
958: for (my $m=0; $m<@sort_d; $m++) {
959: my $idsecentry = $$idlist{$$codetitles[4]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]}{$sort_d[$m]};
960: $$script_tag .= qq| idsections[$j][$k][$l][$m] = new Array("$idsecentry")\n|;
961: }
962: }
963: }
964: }
965: $$script_tag .= (<<END_OF_BLOCK);
966: if (caller == "semester") {
967: document.forms.logproblem.iddept.length = 0
968: document.forms.logproblem.idclass.length = 0
969: document.forms.logproblem.idsec.length = 0
970: document.forms.logproblem.iddept.options[0] = new Option("<-Pick sem.","-1",true,true)
971: document.forms.logproblem.idclass.options[0] = new Option("<-Pick dept.","-1",true,true)
972: document.forms.logproblem.idsec.options[0] = new Option("Pick course first (above)","-1",true,true)
973: if (idyr == 0) {
974: document.forms.logproblem.idsem.length = 0
975: document.forms.logproblem.idsem.options[0] = new Option("<-Pick year","-1",true,true)
976: }
977: else {
978: document.forms.logproblem.idsem.length = 0
979: document.forms.logproblem.idsem.options[0] = new Option("Select","-1",true,true)
980: for (var i=0; i<idsems[idyr-1].length; i++) {
981: document.forms.logproblem.idsem.options[i+1] = new Option(idsemlongs[idyr-1][i],idsems[idyr-1][i],false,false)
982: }
983: }
984: document.forms.logproblem.idsem.selectedIndex = 0;
985: }
986: if (caller == "dept") {
987: document.forms.logproblem.iddept.length = 0
988: document.forms.logproblem.idclass.length = 0
989: document.forms.logproblem.idsec.length = 0
990: document.forms.logproblem.idclass.options[0] = new Option("<-Pick dept.","-1",true,true)
991: document.forms.logproblem.idsec.options[0] = new Option("Pick course first (above)","-1",true,true)
992: if (idsem == 0) {
993: document.forms.logproblem.iddept.options[0] = new Option("<-Pick sem.","-1",true,true)
994: document.forms.logproblem.iddept.options[0] = new Option("<-Pick sem.","-1",true,true)
995: }
996: else {
997: document.forms.logproblem.iddept.options[0] = new Option("Select","-1",true,true)
998: for (var i=0; i<idcodes[idyr-1][idsem-1].length; i++) {
999: document.forms.logproblem.iddept.options[i+1] = new Option(idcodes[idyr-1][idsem-1][i],idcodes[idyr-1][idsem-1][i],false,false)
1000: }
1001: }
1002: document.forms.logproblem.iddept.selectedIndex = 0
1003: }
1004: if (caller == "course") {
1005: document.forms.logproblem.idclass.length = 0
1006: document.forms.logproblem.idsec.length = 0
1007: document.forms.logproblem.idsec.options[0] = new Option("Pick course first (above)","-1",true,true)
1008: if (iddept == 0) {
1009: document.forms.logproblem.idclass.options[0] = new Option("<-Pick dept.","-1",true,true)
1010: }
1011: else {
1012: document.forms.logproblem.idclass.options[0] = new Option("Select","-1",true,true)
1013: for (var i=0; i<idcourses[idyr-1][idsem-1][iddept-1].length; i++) {
1014: 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)
1015: }
1016: }
1017: document.forms.logproblem.idclass.selectedIndex = 0
1018: }
1019: }
1020: END_OF_BLOCK
1021: }
1022:
1.1 raeburn 1023: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>