[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm

raeburn raeburn at source.lon-capa.org
Tue Feb 14 16:44:16 EST 2023


raeburn		Tue Feb 14 21:44:16 2023 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - Eliminate javascript error when configuring link protection in a domain
    with no existing LTI configuration.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.418 loncom/interface/domainprefs.pm:1.419
--- loncom/interface/domainprefs.pm:1.418	Thu Nov 17 21:43:38 2022
+++ loncom/interface/domainprefs.pm	Tue Feb 14 21:44:15 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.418 2022/11/17 21:43:38 raeburn Exp $
+# $Id: domainprefs.pm,v 1.419 2023/02/14 21:44:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -167,6 +167,7 @@
 use Apache::lonconfigsettings;
 use Apache::lonuserutils();
 use Apache::loncoursequeueadmin();
+use Apache::courseprefs();
 use LONCAPA qw(:DEFAULT :match);
 use LONCAPA::Enrollment;
 use LONCAPA::lonauthcgi();
@@ -3431,8 +3432,17 @@
 sub lti_javascript {
     my ($dom,$settings) = @_;
     my $togglejs = &lti_toggle_js($dom);
+    my $linkprot_js = &Apache::courseprefs::linkprot_javascript();
     unless (ref($settings) eq 'HASH') {
-        return $togglejs;
+        return $togglejs.'
+<script type="text/javascript">
+// <![CDATA[
+
+'.$linkprot_js.'
+
+// ]]>
+</script>
+';
     }
     my (%ordered,$total,%jstext);
     $total = scalar(keys(%{$settings}));
@@ -3450,7 +3460,6 @@
         push(@jsarray,$ordered{$item});
     }
     my $jstext = '    var lti = Array('."'".join("','", at jsarray)."'".');'."\n";
-    my $linkprot_js = &Apache::courseprefs::linkprot_javascript();
     return <<"ENDSCRIPT";
 <script type="text/javascript">
 // <![CDATA[




More information about the LON-CAPA-cvs mailing list