'.$codetitles[0].' '."\n".
- ' | ');
- for (my $i=1; $i<$numtitles; $i++) {
- $r->print(''.$codetitles[$i].' '."\n".
- ''."\n".
- ''."\n".
- ''."\n".
- ' | '
- );
+ }
+ }
+ return $level;
+}
+
+sub build_javascript {
+ my ($by_year,$by_sem,$by_dept,$cat_order,$codetitles) = @_;
+ my @unsorted = keys(%{$by_year});
+ my @sorted_yrs;
+ &Apache::courseclassifier::sort_cats('0',$cat_order,$codetitles,\@unsorted,\@sorted_yrs);
+ my $output = 'var idcse_by_yr_year = new Array("'.join('","',@sorted_yrs).'");'."\n".
+ 'var idcse_by_yr_dept = new Array('.scalar(@sorted_yrs).');'."\n".
+ 'var idcse_by_yr_num = new Array('.scalar(@sorted_yrs).');'."\n";
+ for (my $i=0; $i<@sorted_yrs; $i++) {
+ my $numkeys = keys(%{$by_year->{$sorted_yrs[$i]}});
+ $output .= " idcse_by_yr_num[$i] = new Array($numkeys);\n";
+ if (ref($by_year->{$sorted_yrs[$i]}) eq 'HASH') {
+ @unsorted = keys(%{$by_year->{$sorted_yrs[$i]}});
+ my @sorted_depts;
+ &Apache::courseclassifier::sort_cats('2',$cat_order,$codetitles,\@unsorted,\@sorted_depts);
+ $output .= qq| idcse_by_yr_dept[$i] = new Array ("|.join('","',@sorted_depts).'");'."\n";
+ for (my $j=0; $j<@sorted_depts; $j++) {
+ $output .= qq| idcse_by_yr_num[$i][$j] = new Array ("|;
+ $output .= join('","',sort(@{$by_year->{$sorted_yrs[$i]}->{$sorted_depts[$j]}})).'");'."\n";
}
- $r->print('