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

raeburn raeburn at source.lon-capa.org
Fri Jul 26 14:03:59 EDT 2019


raeburn		Fri Jul 26 18:03:59 2019 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonsupportreq.pm 
  Log:
  - For 2.11
    Backport 1.94 (part), 1.96
  
  
Index: loncom/interface/lonsupportreq.pm
diff -u loncom/interface/lonsupportreq.pm:1.79.2.3 loncom/interface/lonsupportreq.pm:1.79.2.4
--- loncom/interface/lonsupportreq.pm:1.79.2.3	Mon Jan 23 19:57:30 2017
+++ loncom/interface/lonsupportreq.pm	Fri Jul 26 18:03:59 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Helpdesk request form
 #
-# $Id: lonsupportreq.pm,v 1.79.2.3 2017/01/23 19:57:30 raeburn Exp $
+# $Id: lonsupportreq.pm,v 1.79.2.4 2019/07/26 18:03:59 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -69,7 +69,9 @@
         }
     }
     my $origurl = $env{'form.origurl'};
-    $origurl =~ s{^https?://}{};
+    if ($origurl =~ m{^https?://[^/]+(.*)$}) {
+        $origurl =~ $1;
+    }
     $origurl =~ s/(`)//g;
     $origurl =~ s/\$/\(\$\)/g;
     my $command = $env{'form.command'};
@@ -151,7 +153,6 @@
         }
     }
 
-    my %coursecodes;
     my %codes;
     my @codetitles;
     my %cat_titles;
@@ -159,9 +160,7 @@
     my %idlist;
     my %idnums;
     my %idlist_titles;
-    my $caller = 'global';
     my $totcodes = 0;
-    my $format_reply;
     my $jscript = '';
     my $loaditems = qq|
 function initialize_codes() {
@@ -169,10 +168,17 @@
 }
     |;
     unless ($helpform{'course'} eq 'no') {
-        $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom);
-        if ($totcodes > 0) {
-            $format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order);
-            if ($format_reply 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') &&
+                (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));
+            }
+            if ($totcodes > 0) {
                 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);
@@ -708,8 +714,12 @@
         $coursecode = $env{'form.coursecode'};
         if ($coursecode eq '') {
             my $totcodes = 0;
-            my %coursecodes;
-            $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom);
+            my $instcats = &Apache::lonnet::get_dom_instcats($defdom);
+            if (ref($instcats) eq 'HASH') {
+                if (ref($instcats->{'codes'}) eq 'HASH') {
+                    $totcodes = scalar(keys(%{$instcats->{'codes'}}));
+                }
+            }
             my @standardnames = &Apache::loncommon::get_standard_codeitems();
             if ($totcodes > 0) {
                 my $noregexps = 1;




More information about the LON-CAPA-cvs mailing list