[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonuserutils.pm

raeburn raeburn at source.lon-capa.org
Fri Jul 26 14:37:16 EDT 2019


raeburn		Fri Jul 26 18:37:16 2019 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonuserutils.pm 
  Log:
  - For 2.11
    Backport 1.201
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.184.4.2 loncom/interface/lonuserutils.pm:1.184.4.3
--- loncom/interface/lonuserutils.pm:1.184.4.2	Sun Jul  7 19:00:53 2019
+++ loncom/interface/lonuserutils.pm	Fri Jul 26 18:37:16 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.184.4.2 2019/07/07 19:00:53 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.184.4.3 2019/07/26 18:37:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2287,7 +2287,6 @@
 
 sub courses_selector {
     my ($cdom,$formname) = @_;
-    my %coursecodes = ();
     my %codes = ();
     my @codetitles = ();
     my %cat_titles = ();
@@ -2300,14 +2299,15 @@
     my $jscript = '';
 
     my $totcodes = 0;
-    $totcodes =
-        &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,
-                                                      $cdom,$totcodes);
-    if ($totcodes > 0) {
-        $format_reply =
-             &Apache::lonnet::auto_instcode_format($caller,$cdom,\%coursecodes,
-                                \%codes,\@codetitles,\%cat_titles,\%cat_order);
-        if ($format_reply eq 'ok') {
+    my $instcats = &Apache::lonnet::get_dom_instcats($cdom);
+    if (ref($instcats) eq 'HASH') {
+        if ((ref($instcats->{'codetitles'}) eq 'ARRAY') && (ref($instcats->{'codes'}) eq 'HASH') &&
+            (ref($instcats->{'cat_titles'}) eq 'HASH') && (ref($instcats->{'cat_order'}) eq 'HASH')) {
+            %codes = %{$instcats->{'codes'}};
+            @codetitles = @{$instcats->{'codetitles'}};
+            %cat_titles = %{$instcats->{'cat_titles'}};
+            %cat_order = %{$instcats->{'cat_order'}};
+            $totcodes = scalar(keys(%codes));
             my $numtypes = @codetitles;
             &Apache::courseclassifier::build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles);
             my ($scripttext,$longtitles) = &Apache::courseclassifier::javascript_definitions(\@codetitles,\%idlist,\%idlist_titles,\%idnums,\%cat_titles);
@@ -2344,7 +2344,8 @@
     }
     courseSet('$codetitles[1]');
     for (var j=0; j<formname.Department.length; j++) {
-        if (formname.Department.options[j].value == "$env{'form.Department'}") {            formname.Department.options[j].selected = true;
+        if (formname.Department.options[j].value == "$env{'form.Department'}") {
+            formname.Department.options[j].selected = true;
         }
     }
     if (formname.Department.options[formname.Department.selectedIndex].value == -1) {




More information about the LON-CAPA-cvs mailing list