Annotation of loncom/interface/courseclassifier.pm, revision 1.12
1.5 raeburn 1: # The LearningOnline Network with CAPA
2: # Utilities for classifying courses based on institutional code
3: #
1.12 ! raeburn 4: # $Id: courseclassifier.pm,v 1.11 2010/12/03 04:28:36 raeburn Exp $
1.1 raeburn 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA#
23: # /home/httpd/html/adm/gpl.txt
24: #
25: # http://www.lon-capa.org/
26: #
27:
28: package Apache::courseclassifier;
29:
30: use strict;
31: use lib '/home/httpd/lib/perl/';
32: use Apache::lonnet;
1.10 raeburn 33: use Apache::loncommon;
1.6 raeburn 34: use Apache::lonlocal;
1.1 raeburn 35: use LONCAPA;
36:
37: sub retrieve_instcodes {
1.2 raeburn 38: my ($coursecodes,$codedom) = @_;
39: my $totcodes;
1.1 raeburn 40: my %courses = &Apache::lonnet::courseiddump($codedom,'.',1,'.','.','.', undef,undef,'Course');
1.2 raeburn 41: foreach my $course (keys(%courses)) {
42: if (ref($courses{$course}) eq 'HASH') {
1.11 raeburn 43: if ($courses{$course}{'inst_code'} ne '') {
44: $$coursecodes{$course} = $courses{$course}{'inst_code'};
45: $totcodes ++;
46: }
1.1 raeburn 47: }
48: }
49: return $totcodes;
50: }
51:
52: sub sort_cats {
53: my ($num,$cat_order,$codetitles,$idsarrayref,$sorted) = @_;
54: my @unsorted = @{$idsarrayref};
55: if (defined($$cat_order{$$codetitles[$num]})) {
56: foreach my $item (@{$$cat_order{$$codetitles[$num]}}) {
57: if (grep/^\Q$item\E$/,@unsorted) {
1.12 ! raeburn 58: push(@{$sorted},$item);
1.1 raeburn 59: }
60: }
61: } else {
62: @{$sorted} = sort (@unsorted);
63: }
64: }
65:
66: sub recurse_list {
67: my ($cid,$codetitles,$codes,$num,$idarrays) = @_;
68: if ($num == 0) {
69: if (!grep/^$$codes{$cid}{$$codetitles[0]}$/,@{$$idarrays{$$codetitles[0]}}) {
70: push @{$$idarrays{$$codetitles[0]}}, $$codes{$cid}{$$codetitles[0]};
71: }
72: } elsif ($num == 1) {
73: if (defined($$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}})) {
74: if (!grep/^$$codes{$cid}{$$codetitles[1]}$/,@{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}}) {
75: push @{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}}, $$codes{$cid}{$$codetitles[1]};
76: }
77: } else {
78: @{$$idarrays{$$codetitles[1]}{$$codes{$cid}{$$codetitles[0]}}} = ("$$codes{$cid}{$$codetitles[1]}");
79: }
80: } elsif ($num == 2) {
81: if (defined($$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}})) {
82: if (defined($$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
83: if (!grep/^$$codes{$cid}{$$codetitles[2]}$/,@{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}}) {
84: push @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}}, $$codes{$cid}{$$codetitles[2]};
85: }
86: } else {
87: @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ("$$codes{$cid}{$$codetitles[2]}"); }
88: } else {
89: %{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}} = ();
90: @{$$idarrays{$$codetitles[2]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ("$$codes{$cid}{$$codetitles[2]}");
91: }
92: } elsif ($num == 3) {
93: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}})) {
94: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
95: if (defined($$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}})) {
96: if (!grep/^$$codes{$cid}{$$codetitles[3]}$/,@{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}}) {
97: push @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}}, $$codes{$cid}{$$codetitles[3]};
98: }
99: } else {
100: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
101: }
102: } else {
103: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
104: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
105: }
106: } else {
107: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}} = ();
108: %{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
109: @{$$idarrays{$$codetitles[3]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ("$$codes{$cid}{$$codetitles[3]}");
110: }
111: } elsif ($num == 4) {
112: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}})) {
113: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}})) {
114: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}})) {
115: if (defined($$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}})) {
116: 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]}}}) {
117: push @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}}, $$codes{$cid}{$$codetitles[4]};
118: }
119: } else {
120: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
121: }
122: } else {
123: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
124: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
125: }
126: } else {
127: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
1.4 raeburn 128: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
129: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[4]}");
1.1 raeburn 130: }
131: } else {
132: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}} = ();
133: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}} = ();
134: %{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[2]}}} = ();
135: @{$$idarrays{$$codetitles[4]}{$$codes{$cid}{$$codetitles[0]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[1]}}{$$codes{$cid}{$$codetitles[3]}}} = ("$$codes{$cid}{$$codetitles[3]}");
136: }
137: }
138: $num ++;
139: if ($num <@{$codetitles}) {
140: &recurse_list($cid,$codetitles,$codes,$num,$idarrays);
141: }
142: }
143:
144: sub build_code_selections {
145: my ($codes,$codetitles,$cat_titles,$cat_order,$idlist,$idnums,$idlist_titles) = @_;
146: my %idarrays = ();
147: for (my $i=1; $i<@{$codetitles}; $i++) {
148: %{$idarrays{$$codetitles[$i]}} = ();
149: }
150: foreach my $cid (sort keys %{$codes}) {
151: &recurse_list($cid,$codetitles,$codes,0,\%idarrays);
152: }
153: for (my $num=0; $num<@{$codetitles}; $num++) {
154: if ($num == 0) {
155: my @contents = ();
156: my @contents_titles = ();
157: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[0]}},\@contents);
158: if (defined($$cat_titles{$$codetitles[0]})) {
159: foreach (@contents) {
160: push @contents_titles, $$cat_titles{$$codetitles[0]}{$_};
161: }
162: }
163: $$idlist{$$codetitles[0]} = join('","',@contents);
164: $$idnums{$$codetitles[0]} = scalar(@contents);
165: if (defined($$cat_titles{$$codetitles[0]})) {
166: $$idlist_titles{$$codetitles[0]} = join('","',@contents_titles);
167: }
168: } elsif ($num == 1) {
169: %{$$idlist{$$codetitles[1]}} = ();
170: %{$$idlist_titles{$$codetitles[1]}} = ();
171: foreach my $key_a (keys %{$idarrays{$$codetitles[1]}}) {
172: my @sorted_a = ();
173: my @sorted_a_titles = ();
174: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[1]}{$key_a}},\@sorted_a);
175: if (defined($$cat_titles{$$codetitles[1]})) {
176: foreach (@sorted_a) {
177: push @sorted_a_titles, $$cat_titles{$$codetitles[1]}{$_};
178: }
179: }
180: $$idlist{$$codetitles[1]}{$key_a} = join('","',@sorted_a);
181: $$idnums{$$codetitles[1]}{$key_a} = scalar(@sorted_a);
182: if (defined($$cat_titles{$$codetitles[1]})) {
183: $$idlist_titles{$$codetitles[1]}{$key_a} = join('","',@sorted_a_titles);
184: }
185: }
186: } elsif ($num == 2) {
187: %{$$idlist{$$codetitles[2]}} = ();
188: %{$$idlist_titles{$$codetitles[2]}} = ();
189: foreach my $key_a (keys %{$idarrays{$$codetitles[2]}}) {
190: %{$$idlist{$$codetitles[2]}{$key_a}} = ();
191: %{$$idlist_titles{$$codetitles[2]}{$key_a}} = ();
192: foreach my $key_b (keys %{$idarrays{$$codetitles[2]}{$key_a}}) {
193: my @sorted_b = ();
194: my @sorted_b_titles = ();
195: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[2]}{$key_a}{$key_b}},\@sorted_b);
196: if (defined($$cat_titles{$$codetitles[2]})) {
197: foreach (@sorted_b) {
198: push @sorted_b_titles, $$cat_titles{$$codetitles[2]}{$_};
199: }
200: }
201: $$idlist{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b);
202: $$idnums{$$codetitles[2]}{$key_a}{$key_b} = scalar(@sorted_b);
203: if (defined($$cat_titles{$$codetitles[2]})) {
204: $$idlist_titles{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b_titles);
205: }
206: }
207: }
208: } elsif ($num == 3) {
209: %{$$idlist{$$codetitles[3]}} = ();
210: foreach my $key_a (keys %{$idarrays{$$codetitles[3]}}) {
211: %{$$idlist{$$codetitles[3]}{$key_a}} = ();
212: foreach my $key_b (keys %{$idarrays{$$codetitles[3]}{$key_a}}) {
213: %{$$idlist{$$codetitles[3]}{$key_a}{$key_b}} = ();
214: foreach my $key_c (keys %{$idarrays{$$codetitles[3]}{$key_a}{$key_b}}) {
215: my @sorted_c = ();
216: my @sorted_c_titles = ();
217: &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[3]}{$key_a}{$key_b}{$key_c}},\@sorted_c);
218: if (defined($$cat_titles{$$codetitles[3]})) {
219: foreach (@sorted_c) {
220: push @sorted_c_titles, $$cat_titles{$$codetitles[3]}{$_};
221: }
222: }
223: $$idlist{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = join('","',@sorted_c);
224: $$idnums{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = scalar(@sorted_c);
225: if (defined($$cat_titles{$$codetitles[3]})) {
1.4 raeburn 226: $$idlist_titles{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = join('","',@sorted_c_titles);
1.1 raeburn 227: }
228: }
229: }
230: }
231: } elsif ($num == 4) {
232: %{$$idlist{$$codetitles[4]}} = ();
233: foreach my $key_a (keys %{$idarrays{$$codetitles[4]}}) {
234: %{$$idlist{$$codetitles[4]}{$key_a}} = ();
235: foreach my $key_b (keys %{$idarrays{$$codetitles[4]}{$key_a}}) {
236: %{$$idlist{$$codetitles[4]}{$key_a}{$key_b}} = ();
237: foreach my $key_c (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}}) {
238: %{$$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}} = ();
239: foreach my $key_d (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}}) {
240: my @sorted_d = ();
241: my @sorted_d_titles = ();
242: &sort_cats($num,$cat_order,$codetitles,$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d},\@sorted_d);
243: if (defined($$cat_titles{$$codetitles[4]})) {
244: foreach (@sorted_d) {
245: push @sorted_d_titles, $$cat_titles{$$codetitles[4]}{$_};
246: }
247: }
248: $$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = join('","',@sorted_d);
249: $$idnums{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = scalar(@sorted_d);
1.4 raeburn 250: if (defined($$cat_titles{$$codetitles[4]})) {
251: $$idlist_titles{$$codetitles[3]}{$key_a}{$key_b}{$key_c}{$key_d} = join('","',@sorted_d_titles);
252: }
1.1 raeburn 253: }
254: }
255: }
256: }
257: }
258: }
259: }
260:
261: sub javascript_code_selections {
262: my ($formname,@codetitles) = @_;
263: my $numtitles = @codetitles;
1.10 raeburn 264: my %lt = &Apache::lonlocal::texthash(
265: Select => 'Select',
266: Pick => 'Pick',
267: );
1.1 raeburn 268: my $output = (<<END_OF_BLOCK);
269: var display = new Array($numtitles)
270: if (caller == "" || caller == "$codetitles[0]") {
271: if (caller == "") {
272: document.$formname.Year.length = 0
1.10 raeburn 273: document.$formname.Year.options[0] = new Option("$lt{'Select'}","-1",true,true)
1.1 raeburn 274: display[0] = new Array(idyears.length)
275: for (var i=0; i<idyears.length; i++) {
276: display[0][i] = idyears[i]
277: if (longtitles[0] == 1) {
278: if (idyearslongs[i] != "") {
279: display[0][i] = idyearslongs[i]
280: }
281: }
282: else {
283: if (idyearslongs[i] != "") {
284: display[0][i] = idyears[i]
285: }
286: }
287: document.$formname.Year.options[i+1] = new Option(display[0][i],idyears[i],false,false)
288: }
289: document.$formname.Year.selectedIndex = 0;
290: }
291: document.$formname.Semester.length = 0
292: document.$formname.Department.length = 0;
293: document.$formname.Number.length = 0
1.10 raeburn 294: document.$formname.Department.options[0] = new Option("<-$lt{'Pick'} $codetitles[1]","-1",true,true)
295: document.$formname.Number.options[0] = new Option("<-$lt{'Pick'} $codetitles[2]","-1",true,true)
1.1 raeburn 296: if (idyr == 0 || caller == "") {
1.10 raeburn 297: document.$formname.Semester.options[0] = new Option("<-$lt{'Pick'} $codetitles[0]","-1",true,true)
1.1 raeburn 298: }
299: else {
1.10 raeburn 300: document.$formname.Semester.options[0] = new Option("$lt{'Select'}","-1",true,true)
1.1 raeburn 301: display[1] = new Array(idsems[idyr-1].length)
302: for (var i=0; i<idsems[idyr-1].length; i++) {
303: display[1][i] = idsems[idyr-1][i]
304: if (longtitles[1] == 1) {
305: if (idsemslongs[idyr-1][i] != "") {
306: display[1][i] = idsemslongs[idyr-1][i]
307: }
308: }
309: document.$formname.Semester.options[i+1] = new Option(display[1][i],idsems[idyr-1][i],false,false)
310: }
311: }
312: document.$formname.Semester.selectedIndex = 0;
313: }
314: if (caller == "$codetitles[1]") {
315: document.$formname.Department.length = 0
316: document.$formname.Number.length = 0
317: document.$formname.Number.options[0] = new Option("<-Pick $codetitles[2]","-1",true,true)
318: if (idsem == 0) {
1.10 raeburn 319: document.$formname.Department.options[0] = new Option("<-$lt{'Pick'} $codetitles[1]","-1",true,true)
1.1 raeburn 320: }
321: else {
1.10 raeburn 322: document.$formname.Department.options[0] = new Option("$lt{'Select'}","-1",true,true)
1.1 raeburn 323: display[2] = new Array(idcodes[idyr-1][idsem-1].length)
324: for (var i=0; i<idcodes[idyr-1][idsem-1].length; i++) {
325: display[2][i] = idcodes[idyr-1][idsem-1][i]
326: if (longtitles[2] == 1) {
327: if (idcodeslongs[idyr-1][idsem-1][i] != "") {
328: display[2][i] = idcodeslongs[idyr-1][idsem-1][i]
329: }
330: }
331: document.$formname.Department.options[i+1] = new Option(display[2][i],idcodes[idyr-1][idsem-1][i],false,false)
332: }
333: }
334: document.$formname.Department.selectedIndex = 0
335: }
336: if (caller == "$codetitles[2]") {
337: document.$formname.Number.length = 0
338: if (iddept == 0) {
1.10 raeburn 339: document.$formname.Number.options[0] = new Option("<-$lt{'Pick'} $codetitles[2]","-1",true,true)
1.1 raeburn 340: }
341: else {
342: document.$formname.Number.options[0] = new Option("Select","-1",true,true)
343: display[3] = new Array (idcourses[idyr-1][idsem-1][iddept-1].length)
344: for (var i=0; i<idcourses[idyr-1][idsem-1][iddept-1].length; i++) {
345: display[3][i] = idcourses[idyr-1][idsem-1][iddept-1][i]
346: if (longtitles[3] == 1) {
347: if (idcourseslongs[idyr-1][idsem-1][iddept-1][i] != "") {
348: display[3][i] = idcourseslongs[idyr-1][idsem-1][iddept-1][i]
349: }
350: }
351: document.$formname.Number.options[i+1] = new Option(display[3][i],idcourses[idyr-1][idsem-1][iddept-1][i],false,false)
352: }
353: }
354: document.$formname.Number.selectedIndex = 0
355: }
356: }
357:
358: function initialize_codes() {
359: courseSet();
360: return;
361: }
362: END_OF_BLOCK
363: }
364:
365:
366: sub javascript_definitions {
367: my ($codetitles,$idlist,$idlist_titles,$idnums,$cat_titles) = @_;
368: my $numtitles = @{$codetitles};
369: my $longtitles = [];
370: for (my $i=0; $i<$numtitles; $i++) {
371: if (defined($cat_titles->{$codetitles->[$i]})) {
372: $longtitles->[$i] = 1;
373: } else {
374: $longtitles->[$i] = 0;
375: }
376: }
377: my $scripttext;
378: if ($longtitles->[0]) {
379: $scripttext =
380: qq| var idyearslongs = new Array("$idlist_titles->{$codetitles->[0]}")\n|;
381: }
382: $scripttext .=
383: " var idsems = new Array ($idnums->{$codetitles->[0]})\n";
384: if ($longtitles->[1]) {
385: $scripttext .=
386: " var idsemslongs = new Array ($idnums->{$codetitles->[0]})\n"; }
387: $scripttext .=
388: " var idcodes = new Array ($idnums->{$codetitles->[0]})\n";
389: if ($longtitles->[2]) {
390: $scripttext .=
391: " var idcodeslongs = new Array ($idnums->{$codetitles->[0]})\n";
392: }
393: $scripttext .=
394: " var idcourses = new Array ($idnums->{$codetitles->[0]})\n";
395: if ($longtitles->[3]) {
396: $scripttext .=
397: " var idcourseslongs = new Array ($idnums->{$codetitles->[0]})\n";
398: }
399: my @sort_a = split/","/,$idlist->{$codetitles->[0]};
400: for (my $j=0; $j<@sort_a; $j++) {
401: $scripttext .= qq| idsems[$j] = new Array("$idlist->{$codetitles->[1]}{$sort_a[$j]}")\n|;
402: if ($longtitles->[1]) {
403: $scripttext .= qq| idsemslongs[$j] = new Array("$idlist_titles->{$codetitles->[1]}{$sort_a[$j]}")\n|;
404: }
405: $scripttext .= qq| idcodes[$j] = new Array($idnums->{$codetitles->[1]}{$sort_a[$j]})\n|;
406: if ($longtitles->[2]) {
407: $scripttext .= qq| idcodeslongs[$j] = new Array($idnums->{$codetitles->[1]}{$sort_a[$j]})\n|;
408: }
409: $scripttext .= qq| idcourses[$j] = new Array($idnums->{$codetitles->[1]}{$sort_a[$j]})\n|;
410: if ($longtitles->[3]) {
411: $scripttext .= qq| idcourseslongs[$j] = new Array($idnums->{$codetitles->[1]}{$sort_a[$j]})\n|;
412: }
413: my @sort_b = split/","/,$idlist->{$codetitles->[1]}{$sort_a[$j]};
414: for (my $k=0; $k<@sort_b; $k++) {
415: my $idcode_entry = $idlist->{$codetitles->[2]}{$sort_a[$j]}{$sort_b[$k]};
416: $scripttext .= qq| idcodes[$j][$k] = new Array("$idcode_entry")\n|;
417: if ($longtitles->[2]) {
418: my $idcodelong_entry = $idlist_titles->{$codetitles->[2]}{$sort_a[$j]}{$sort_b[$k]};
419: $scripttext .= qq| idcodeslongs[$j][$k] = new Array("$idcodelong_entry")\n|;
420: }
421: $scripttext .= qq| idcourses[$j][$k] = new Array($idnums->{$codetitles->[2]}{$sort_a[$j]}{$sort_b[$k]})\n|;
422: if ($longtitles->[3]) {
423: $scripttext .= qq| idcourseslongs[$j][$k] = new Array($idnums->{$codetitles->[2]}{$sort_a[$j]}{$sort_b[$k]})\n|;
424: }
425: my @sort_c = split/","/,$idlist->{$codetitles->[2]}{$sort_a[$j]}{$sort_b[$k]};
426: for (my $l=0; $l<@sort_c; $l++) {
427: my $idcourse_entry = $idlist->{$codetitles->[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]};
428: $scripttext .= qq| idcourses[$j][$k][$l] = new Array("$idcourse_entry")\n|;
429: if ($longtitles->[3]) {
430: my $idcourselong_entry = $idlist_titles->{$codetitles->[3]}{$sort_a[$j]}{$sort_b[$k]}{$sort_c[$l]};
431: $scripttext .= qq| idcourseslongs[$j][$k][$l] = new Array("$idcourselong_entry")\n|;
432: }
433: }
434: }
435: }
436: return ($scripttext,$longtitles);
437: }
438:
439: sub courseset_js_start {
440: my ($formname,$longtitles_str,$allidlist) = @_;
441: my $output = <<END;
1.6 raeburn 442:
1.1 raeburn 443: function courseSet(caller) {
444: var longtitles = new Array ("$longtitles_str");
445: var idyr = document.$formname.Year.selectedIndex
446: var idsem = document.$formname.Semester.selectedIndex
447: var iddept = document.$formname.Department.selectedIndex
448: var idclass = document.$formname.Number.selectedIndex
449: var idyears = new Array("$allidlist");
450: END
451: return $output;
452: }
453:
1.6 raeburn 454: sub instcode_selectors_data {
1.7 raeburn 455: my ($codedom,$formname,$cat_items,$codetitles,$cat_titles,$cat_order,$officialjs) = @_;
1.6 raeburn 456: my ($jscript,%coursecodes,%codes,%idlist,%idnums,%idlist_titles,
457: %by_year,%by_sem,%by_dept);
458: my ($numtitles,$lasttitle);
459: my $caller = 'global';
460: my $totcodes = &retrieve_instcodes(\%coursecodes,$codedom);
461: if ($totcodes > 0) {
462: if (&Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,
463: \%codes,$codetitles,$cat_titles,$cat_order) eq 'ok') {
464: &build_code_selections(\%codes,$codetitles,$cat_titles,$cat_order,
465: \%idlist,\%idnums,\%idlist_titles);
466: my ($scripttext,$longtitles) =
467: &javascript_definitions($codetitles,\%idlist,\%idlist_titles,
468: \%idnums,$cat_titles);
469: my $longtitles_str = join('","',@{$longtitles});
470: my $allidlist = $idlist{$codetitles->[0]};
471: $numtitles = @{$codetitles};
472: $lasttitle = $numtitles;
473: if ($numtitles > 4) {
474: $lasttitle = 4;
475: }
476: if ($numtitles == 0) {
477: if (!defined($env{'form.state'})) {
478: $env{'form.state'} = 'listing';
479: }
480: } else {
481: my @data = ('top');
482: for (my $k=0; $k<$lasttitle; $k++) {
483: my $cat = $codetitles->[$k];
484: my $level = 1;
485: $level = &recurse_options($codetitles->[$k],$idlist{$codetitles->[$k]},$level,$cat,$cat_items,\@data,\%by_year,\%by_sem,\%by_dept);
486: }
487: $scripttext .= &build_javascript(\%by_year,\%by_sem,\%by_dept,$cat_order,$codetitles);
1.7 raeburn 488: if ($officialjs) {
489: $jscript .= '
490:
491: function toggleOfficial() {';
492: for (my $i=0; $i<@{$codetitles}-1; $i++) {
493: $jscript .= '
494: document.'.$formname.'.'.$codetitles->[$i].'.selectedIndex = 0;';
495: }
496: $jscript .= '
497: }
498:
499: function setOfficial(caller) {
1.8 raeburn 500: if (typeof(caller) != "undefined") {
501: if (caller.options[caller.selectedIndex].value != 0) {
502: if (document.'.$formname.'.official.length > 0) {
503: for (var j=0; j<document.'.$formname.'.official.length; j++) {
504: if (document.'.$formname.'.official[j].value == "on") {
505: document.'.$formname.'.official[j].checked = true;
506: }
507: }
1.7 raeburn 508: }
509: }
510: }
511: return;
512: }
513:
514: ';
515:
516: $officialjs = 'setOfficial(caller);';
517: }
518: $jscript .= &javascript_select_filler($formname,$scripttext,$codetitles,$longtitles_str,$allidlist,$officialjs);
1.6 raeburn 519: if ($env{'form.state'} eq 'listing') {
1.12 ! raeburn 520: my @standardnames = &Apache::loncommon::get_standard_codeitems();
! 521: my %local_to_standard;
! 522: if (ref($codetitles) eq 'ARRAY') {
! 523: for (my $i=0; $i<@{$codetitles}; $i++) {
! 524: $local_to_standard{$codetitles->[$i]} = $standardnames[$i];
! 525: }
! 526: }
1.6 raeburn 527: $jscript .= '
528: function setElements() {
529: ';
530: for (my $i=0; $i<@{$codetitles}-1; $i++) {
1.12 ! raeburn 531: my $item = $local_to_standard{$codetitles->[$i]};
! 532: if ($env{'form.'.$item} != -1) {
1.6 raeburn 533: $jscript .= '
1.12 ! raeburn 534: for (var j=0; j<document.'.$formname.'.'.$item.'.length; j++) {
! 535: if (document.'.$formname.'.'.$item.'[j].value == "'.$env{'form.'.$item}.'") {
! 536: document.'.$formname.'.'.$item.'.selectedIndex = j;
1.6 raeburn 537: }
538: }
539: ';
540: }
541: }
542: $jscript .= ' courseSet()'."\n";
1.12 ! raeburn 543: my $lastcodetitle = $local_to_standard{$codetitles->[-1]};
! 544: if ($env{'form.'.$lastcodetitle} != -1) {
1.6 raeburn 545: $jscript .= '
1.12 ! raeburn 546: for (var j=0; j<document.'.$formname.'.'.$lastcodetitle.'.length; j++) {
! 547: if (document.'.$formname.'.'.$lastcodetitle.'[j].value == "'.$env{'form.'.$lastcodetitle}.'") {
! 548: document.'.$formname.'.'.$lastcodetitle.'.selectedIndex = j;
1.6 raeburn 549: }
550: }
551: ';
552: }
553: $jscript .= '}';
554: }
555: }
556: }
557: }
558: return ($jscript,$totcodes,$numtitles,$lasttitle);
559: }
560:
561: sub build_instcode_selectors {
562: my ($numtitles,$lasttitle,$cat_items,$codetitles,$cat_titles,$cat_order) = @_;
563: my $output;
1.10 raeburn 564: my @standardnames = &Apache::loncommon::get_standard_codeitems();
1.6 raeburn 565: if ($numtitles > 0) {
566: $output .= '<table><tr>';
567: for (my $k=0; $k<$lasttitle-1; $k++) {
568: my (@items,@unsorted);
569: if (ref($cat_items->{$codetitles->[$k]}) eq 'ARRAY') {
570: @unsorted = @{$cat_items->{$codetitles->[$k]}};
571: }
572: &sort_cats($k,$cat_order,$codetitles,\@unsorted,\@items);
573: my @longitems;
574: if (defined($cat_titles->{$codetitles->[$k]})) {
575: foreach my $item (@items) {
576: push(@longitems,$cat_titles->{$codetitles->[$k]}{$item});
577: }
578: } else {
579: @longitems = @items;
580: }
581: $output .= '<td align="center">'.$codetitles->[$k].'<br />'."\n".
1.9 raeburn 582: '<select name="'.$standardnames[$k].'" onChange="courseSet(this)"'.
583: '>'."\n".'<option value="0">'.&mt('All').'</option>'."\n";
1.6 raeburn 584: for (my $i=0; $i<@items; $i++) {
585: if ($longitems[$i] eq '') {
586: $longitems[$i] = $items[$i];
587: }
588: $output .= ' <option value="'.$items[$i].'">'.$longitems[$i].'</option>';
589: }
590: $output .= '</select></td>';
591: }
592: $output .= '<td align="center">'.$codetitles->[$lasttitle-1].'<br />'."\n".
1.9 raeburn 593: '<select name="'.$standardnames[$lasttitle-1].'">'."\n".
1.6 raeburn 594: '<option value="0">'.&mt('All')."\n".
595: '</option>'."\n".'</select>'."\n".
596: '</td></tr></table>'."\n";
597: if ($numtitles > 4) {
598: $output .= '<br /><br />'.$codetitles->[$numtitles-1].'<br />'."\n".
1.9 raeburn 599: '<input type="text" name="'.$standardnames[$numtitles-1].
1.6 raeburn 600: '" /><br />'."\n";
601: }
602: $output .= '<br />';
603: }
604: return $output;
605: }
606:
607: sub recurse_options {
608: my ($currkey,$currlist,$level,$cat,$cat_options,$data,$by_year,$by_sem,$by_dept) = @_;
609: if (ref($currlist) eq 'HASH') {
610: $level ++;
611: foreach my $key (sort(keys(%{$currlist}))) {
612: $$data[$level-1]= $key;
613: &recurse_options($key,$currlist->{$key},$level,$cat,$cat_options,$data,$by_year,$by_sem,$by_dept);
614: }
615: } else {
616: $level --;
617: my @contents = split(/","/,$currlist);
618: foreach my $item (@contents) {
619: if (!grep(/^\Q$item\E$/,@{$cat_options->{$cat}})) {
620: push(@{$cat_options->{$cat}},$item);
621: }
622: if ($level == 3) {
623: if (!grep/^\Q$item\E$/,@{$by_year->{$data->[1]}->{$currkey}}) {
624: push(@{$by_year->{$data->[1]}->{$currkey}},$item);
625: }
626: if (!grep/^\Q$item\E$/,@{$by_sem->{$data->[2]}->{$currkey}}) {
627: push(@{$by_sem->{$data->[2]}->{$currkey}},$item);
628: }
629: if (!grep/^\Q$item\E$/,@{$by_dept->{$currkey}}) {
630: push(@{$by_dept->{$currkey}},$item);
631: }
632:
633: }
634: }
635: }
636: return $level;
637: }
638:
639: sub build_javascript {
640: my ($by_year,$by_sem,$by_dept,$cat_order,$codetitles) = @_;
641: my @unsorted = keys(%{$by_year});
642: my @sorted_yrs;
643: &sort_cats('0',$cat_order,$codetitles,\@unsorted,\@sorted_yrs); my $output = 'var idcse_by_yr_year = new Array("'.join('","',@sorted_yrs).'");'."\n".
644: 'var idcse_by_yr_dept = new Array('.scalar(@sorted_yrs).');'."\n".
645: 'var idcse_by_yr_num = new Array('.scalar(@sorted_yrs).');'."\n";
646: for (my $i=0; $i<@sorted_yrs; $i++) {
647: my $numkeys = keys(%{$by_year->{$sorted_yrs[$i]}});
648: $output .= " idcse_by_yr_num[$i] = new Array($numkeys);\n";
649: if (ref($by_year->{$sorted_yrs[$i]}) eq 'HASH') {
650: @unsorted = keys(%{$by_year->{$sorted_yrs[$i]}});
651: my @sorted_depts;
652: &Apache::courseclassifier::sort_cats('2',$cat_order,$codetitles,\@unsorted,\@sorted_depts);
653: $output .= qq| idcse_by_yr_dept[$i] = new Array ("|.join('","',@sorted_depts).'");'."\n";
654: for (my $j=0; $j<@sorted_depts; $j++) {
655: $output .= qq| idcse_by_yr_num[$i][$j] = new Array ("|;
656: $output .= join('","',sort(@{$by_year->{$sorted_yrs[$i]}->{$sorted_depts[$j]}})).'");'."\n";
657: }
658: }
659: }
660: @unsorted = keys(%{$by_sem});
661: my @sorted_sems;
662: &sort_cats('1',$cat_order,$codetitles,\@unsorted,\@sorted_sems);
663: $output .= 'idcse_by_sem_sems = new Array("'.join('","',@sorted_sems).'");'."\n".
664: 'idcse_by_sem_dept = new Array('.scalar(@sorted_sems).');'."\n".
665: 'idcse_by_sem_num = new Array('.scalar(@sorted_sems).');'."\n";
666: for (my $i=0; $i<@sorted_sems; $i++) {
667: my $numkeys = keys(%{$by_sem->{$sorted_sems[$i]}});
668: $output .= " idcse_by_sem_num[$i] = new Array($numkeys);\n";
669: if (ref($by_sem->{$sorted_sems[$i]}) eq 'HASH') {
670: @unsorted = keys(%{$by_sem->{$sorted_sems[$i]}});
671: my @sorted_depts;
672: &sort_cats('2',$cat_order,$codetitles,\@unsorted,\@sorted_depts);
673: $output .= qq| idcse_by_sem_dept[$i] = new Array("|.join('","',@sorted_depts).'");'."\n";
674: for (my $j=0; $j<@sorted_depts; $j++) {
675: $output .= qq| idcse_by_sem_num[$i][$j] = new Array ("|.join('","',sort(@{$by_sem->{$sorted_sems[$i]}->{$sorted_depts[$j]}})).'");'."\n";
676: }
677: }
678: }
679: @unsorted = keys(%{$by_dept});
680: my @sorted_deps;
681: &sort_cats('2',$cat_order,$codetitles,\@unsorted,\@sorted_deps);
682: $output .= 'idcse_by_dep = new Array('.scalar(@sorted_deps).');'."\n";
683: for (my $k=0; $k<@sorted_deps; $k++) {
684: $output .= qq| idcse_by_dep[$k] = new Array ("|.join('","',sort(@{$by_dept->{$sorted_deps[$k]}})).'");'."\n";
685: }
686: return $output;
687: }
688:
689: sub javascript_select_filler {
1.7 raeburn 690: my ($formname,$scripttext,$codetitles,$longtitles_str,$allidlist,$officialjs) = @_;
1.6 raeburn 691: my $output = <<END;
692:
1.7 raeburn 693: function courseSet(caller) {
1.6 raeburn 694: var longtitles = new Array ("$longtitles_str");
695: var valyr = document.$formname.Year.options[document.$formname.Year.selectedIndex].value
696: var valsem = document.$formname.Semester.options[document.$formname.Semester.selectedIndex].value
697: var valdept = document.$formname.Department.options[document.$formname.Department.selectedIndex].value
698: var valclass = document.$formname.Number.options[document.$formname.Number.selectedIndex].value
699: var idyears = new Array("$allidlist");
700: var idyr = -1;
701: var idsem = -1;
702: var iddept = -1;
703: document.$formname.Number.length = 0;
704:
705: $scripttext
706:
707: selYear = document.$formname.Year.selectedIndex-1;
708: selSemester = document.$formname.Semester.selectedIndex-1;
709: selDepartment = document.$formname.Department.selectedIndex-1;
710: if (selYear == -1) {
711: if (selSemester == -1) {
712: if (selDepartment > -1) {
713: document.$formname.Number.options[0] = new Option('All','0',false,false);
714: for (var k=0; k<idcse_by_dep[selDepartment].length; k++) {
715: document.$formname.Number.options[k+1] = new Option(idcse_by_dep[selDepartment][k],idcse_by_dep[selDepartment][k],false,false);
716:
717: }
718: }
719: else {
720: document.$formname.Number.options[0] = new Option("All","0",true,true);
721: }
722: }
723: else {
724: if (selDepartment > -1) {
725: for (var i=0; i<idcse_by_sem_sems.length; i++) {
726: if (idcse_by_sem_sems[i] == valsem) {
727: idsem = i;
728: }
729: }
730: if (idsem != -1) {
731: for (var i=0; i<idcse_by_sem_dept[idsem].length; i++) {
732: if (idcse_by_sem_dept[idsem][i] == valdept) {
733: iddept = i;
734: }
735: }
736: }
737: if (iddept != -1) {
738: document.$formname.Number.options[0] = new Option('All','0',false,false);
739: for (var k=0; k<idcse_by_sem_num[idsem][iddept].length; k++) {
740: document.$formname.Number.options[k+1] = new Option(idcse_by_sem_num[idsem][iddept][k],idcse_by_sem_num[idsem][iddept][k],false,false);
741: }
742: }
743: else {
744: document.$formname.Number.options[0] = new Option('No courses','0',true,true);
745: }
746: }
747: else {
748: document.$formname.Number.options[0] = new Option("All","0",true,true);
749: }
750: }
751: }
752: else {
753: if (selSemester == -1) {
754: if (selDepartment > -1) {
755: for (var i=0; i<idcse_by_yr_year.length; i++) {
756: if (idcse_by_yr_year[i] == valyr) {
757: idyr = i;
758: }
759: }
760: if (idyr != -1) {
761: for (var i=0; i<idcse_by_yr_dept[idyr].length; i++) {
762: if (idcse_by_yr_dept[idyr][i] == valdept) {
763: iddept = i;
764: }
765: }
766: }
767: if (iddept != -1) {
768: document.$formname.Number.options[0] = new Option('All','0',false,false);
769: for (var k=0; k<idcse_by_yr_num[idyr][iddept].length; k++) {
770: document.$formname.Number.options[k+1] = new Option(idcse_by_yr_num[idyr][iddept][k],idcse_by_yr_num[idyr][iddept][k],false,false);
771: }
772: }
773: else {
774: document.$formname.Number.options[0] = new Option('No courses','0',true,true);
775: }
776: }
777: else {
778: document.$formname.Number.options[0] = new Option("All","0",true,true);
779: }
780: }
781: else {
782: if (selDepartment > -1) {
783: for (var k=0; k<idyears.length; k++) {
784: if (idyears[k] == valyr) {
785: idyr = k;
786: }
787: }
788: if (idyr != -1) {
789: for (var k=0; k<idsems[idyr].length; k++) {
790: if (idsems[idyr][k] == valsem) {
791: idsem = k;
792: }
793: }
794: }
795: if (idsem != -1) {
796: for (var k=0; k<idcodes[idyr][idsem].length; k++) {
797: if (idcodes[idyr][idsem][k] == valdept) {
798: iddept = k;
799: }
800: }
801: }
802: if (iddept != -1) {
803: document.$formname.Number.options[0] = new Option('All','0',false,false);
804: for (var i=0; i<idcourses[idyr][idsem][iddept].length; i++) {
805: var display = idcourses[idyr][idsem][iddept][i];
806: if (longtitles[3] == 1) {
807: if (idcourseslongs[idyr][idsem][iddept][i] != "") {
808: display = idcourseslongs[idyr][idsem][iddept][i]
809: }
810: }
811: document.$formname.Number.options[i+1] = new Option(display,idcourses[idyr][idsem][iddept][i],false,false)
812: }
813: }
814: else {
815: document.$formname.Number.options[0] = new Option('No courses','0',true,true);
816: }
817: }
818: else {
819: document.$formname.Number.options[0] = new Option('All','0',true,true);
820: }
821: }
822: document.$formname.Number.selectedIndex = 0
823: }
1.7 raeburn 824: $officialjs
1.6 raeburn 825: }
826: END
827: return $output;
828: }
829:
830: sub instcode_search_str {
1.9 raeburn 831: my ($domain,$numtitles,$codetitles) = @_;
1.6 raeburn 832: my $instcode;
833: if (defined($numtitles) && $numtitles == 0) {
834: $instcode = '.+';
835: } else {
836: my (%codedefaults,@code_order);
837: my $defaults_result =
838: &Apache::lonnet::auto_instcode_defaults($domain,\%codedefaults,
839: \@code_order);
1.10 raeburn 840: my @standardnames = &Apache::loncommon::get_standard_codeitems();
1.9 raeburn 841: my %local_to_standard;
842: if (ref($codetitles) eq 'ARRAY') {
843: for (my $i=0; $i<@{$codetitles}; $i++) {
844: $local_to_standard{$codetitles->[$i]} = $standardnames[$i];
845: }
846: }
1.6 raeburn 847: if ($defaults_result eq 'ok') {
848: $instcode ='^';
1.9 raeburn 849: foreach my $loctitle (@code_order) {
850: my $item = $local_to_standard{$loctitle};
851: if ($item ne '') {
852: if ($env{'form.'.$item} eq '0' ) {
1.12 ! raeburn 853: $instcode .= $codedefaults{$loctitle};
1.9 raeburn 854: } else {
855: $instcode .= $env{'form.'.$item};
856: }
1.6 raeburn 857: } else {
1.9 raeburn 858: $instcode .= '.+';
1.6 raeburn 859: }
860: }
861: $instcode .= '$';
862: } else {
863: $instcode = '.+';
864: }
865: }
866: return $instcode;
867: }
868:
1.10 raeburn 869: sub instcode_from_selectors {
870: my ($cdom) = @_;
871: my $instcode;
872: my $caller = 'global';
873: my (%coursecodes,%codes,@codetitles,%cat_titles,%cat_order,
874: %codedefaults,@code_order);
875: my $format_reply =
876: &Apache::lonnet::auto_instcode_format($caller,$cdom,\%coursecodes,
877: \%codes,\@codetitles,\%cat_titles,\%cat_order);
878: my $defaults_result =
879: &Apache::lonnet::auto_instcode_defaults($cdom,\%codedefaults,
880: \@code_order);
881: if (($defaults_result eq 'ok') && ($format_reply eq 'ok')) {
882: my @standardnames = &Apache::loncommon::get_standard_codeitems();
883: my %local_to_standard;
884: for (my $i=0; $i<@codetitles; $i++) {
885: $local_to_standard{$codetitles[$i]} = $standardnames[$i];
886: }
887: foreach my $loctitle (@code_order) {
888: my $category = $local_to_standard{$loctitle};
889: if ($category ne '') {
890: if ($env{'form.'.$category} eq '-1' ) {
891: $instcode .= $codedefaults{$category};
892: } else {
893: $instcode .= $env{'form.'.$category};
894: }
895: } else {
896: $instcode .= '.+';
897: }
898: }
899: }
900: return $instcode;
1.9 raeburn 901: }
902:
1.1 raeburn 903: 1;
904:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>