--- loncom/interface/coursecatalog.pm 2019/07/23 01:30:35 1.101 +++ loncom/interface/coursecatalog.pm 2019/07/23 13:58:53 1.102 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for displaying the course catalog interface # -# $Id: coursecatalog.pm,v 1.101 2019/07/23 01:30:35 raeburn Exp $ +# $Id: coursecatalog.pm,v 1.102 2019/07/23 13:58:53 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -281,7 +281,7 @@ function setCatDepth(depth) { } document.coursecats.catalog_maxdepth.value = depth; } else { - document.coursecats.currcat_0.value = ''; + document.coursecats.currcat_0.value = ''; document.coursecats.catalog_maxdepth.value = ''; } document.coursecats.submit(); @@ -623,8 +623,6 @@ sub validate_input { } elsif (ref($crscatsref) eq 'HASH') { unless (exists($crscatsref->{$env{'form.'.$key}})) { delete($env{'form.'.$key}); - } else { - delete($env{'form.'.$key}); } } else { delete($env{'form.'.$key}); @@ -637,16 +635,11 @@ sub validate_input { sub get_instcode_allowable { my ($codedom,$possvalref) = @_; return 1 unless (ref($possvalref) eq 'HASH'); - my $caller = 'global'; - my %coursecodes = (); - my %codes = (); - my @codetitles = (); - my %cat_titles = (); - my %cat_order = (); - my $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom); - if ($totcodes > 0) { - if (&Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes, - \%codes,\@codetitles,\%cat_titles,\%cat_order) eq 'ok') { + my $instcats = &Apache::lonnet::get_dom_instcats($codedom); + if (ref($instcats) eq 'HASH') { + if ((ref($instcats->{'codetitles'}) eq 'ARRAY') && (ref($instcats->{'codes'}) eq 'HASH')) { + my %codes = %{$instcats->{'codes'}}; + my @codetitles = @{$instcats->{'codetitles'}}; my @standardnames = &Apache::loncommon::get_standard_codeitems(); my %local_to_standard; for (my $i=0; $i<@codetitles; $i++) { @@ -771,13 +764,9 @@ END sub instcode_course_selector { my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs,$codetitles,$cattype,$canviewall) = @_; - my %coursecodes = (); - my %codes = (); my %cat_titles = (); my %cat_order = (); - my %cat_items; - my $caller = 'global'; - my $format_reply; + my %cat_items = (); my %add_entries = (topmargin => "0", marginheight => "0",); my ($jscript,$totcodes,$numtitles,$lasttitle) =