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

raeburn raeburn at source.lon-capa.org
Fri Jun 2 22:29:57 EDT 2023


raeburn		Sat Jun  3 02:29:57 2023 EDT

  Modified files:              
    /loncom/interface	courseprefs.pm 
  Log:
  - Bug 6907
    - Return of grades to launcher CMS supported for resources or folders
      accessed via LTI-mediated deep link.
  
  
-------------- next part --------------
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.121 loncom/interface/courseprefs.pm:1.122
--- loncom/interface/courseprefs.pm:1.121	Thu Jun  1 20:04:36 2023
+++ loncom/interface/courseprefs.pm	Sat Jun  3 02:29:57 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set configuration settings for a course
 #
-# $Id: courseprefs.pm,v 1.121 2023/06/01 20:04:36 raeburn Exp $
+# $Id: courseprefs.pm,v 1.122 2023/06/03 02:29:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1661,14 +1661,28 @@
         } elsif (exists($env{$urlparamname})) {
             $env{$urlparamname} = '';
         }
+        my $passback = 'form.linkprot_passback_'.$idx;
+        my $passbackparamname = 'form.linkprot_passbackformat_'.$idx;
+        if ($env{$passback} == 1) {
+            unless ($env{$passbackparamname} =~ /^1\.(0|1)$/) {
+                $env{$passbackparamname} = '';
+            }
+        } elsif (exists($env{$passbackparamname})) {
+            $env{$passbackparamname} = '';
+        }
         unless ($idx eq 'add') {
             if ((!$current{'returnurl'} && ($env{$urlparamname} ne '')) ||
                 ($current{'returnurl'} && ($env{$urlparamname} eq ''))) {
                 $haschanges{$itemid} = 1;
             }
+            if ((!$current{'passback'} && ($env{$passbackparamname} ne '')) ||
+                ($current{'passback'} && ($env{$passbackparamname} eq ''))) {
+                $haschanges{$itemid} = 1;
+            }
         }
-        if ($env{$urlparamname} ne '') {
-            $linkprot{$itemid}{'returnurl'} = $env{$urlparamname};
+        if ($env{$passbackparamname} ne '') {
+            $linkprot{$itemid}{'passback'} = 1;
+            $linkprot{$itemid}{'passbackformat'} = $env{$passbackparamname};
         }
         if ($ltiauth) {
             my $reqitem = 'form.linkprot_requser_'.$idx;
@@ -3088,7 +3102,7 @@
                     my %values = %{$changes->{$id}};
                     my %desc = &linkprot_names();
                     my $display;
-                    foreach my $title ('name','lifetime','version','key','secret','returnurl') {
+                    foreach my $title ('name','lifetime','version','key','secret','returnurl','passbackformat') {
                         if (($title eq 'key') || ($title eq 'secret')) {
                             if (ref($ltienc{$id}) eq 'HASH') {
                                 if (exists($ltienc{$id}{$title})) {
@@ -3108,6 +3122,12 @@
                             if ($values{$title}) {
                                 $display .= &mt('Return URL parameter').': '.$values{$title}.', '; 
                             }
+                        } elsif ($title eq 'passbackformat') {
+                            if ($values{$title} eq '1.0') {
+                                $display .= &mt('Can return grades to Launcher with Outcomes Service 1.0 format').', ';
+                            } elsif ($values{$title} eq '1.1') {
+                                $display .= &mt('Can return grades to Launcher with Outcomes Service 1.1 format').', ';
+                            }
                         } else {
                             $display .= $desc{$title}.': '.$values{$title}.', ';
                         }
@@ -7316,7 +7336,27 @@
                     '<tr '.$css_class.'><td><span class="LC_nobreak">'.
                     '<label><input type="checkbox" name="linkprot_del" value="'.$i.'"'.$disabled.' />'.
                     &mt('Delete?').'</label></span></td><td>';
-                my ($usersty,$onclickrequser,%checkedrequser,$onclickreturnurl,%checkedreturnurl);
+                my ($usersty,$onclickrequser,%checkedrequser,$onclickreturnurl,%checkedreturnurl,
+                    $onclickpassback,%checkedpassback,$passbacksty,%checkedpassbackfmt);
+                $passbacksty = 'none';
+                $onclickpassback = ' onclick="toggleLinkProtExtra(this.form,'."'passback','passbackparam','1','inline-block','$i'".');"';
+                %checkedpassback = (
+                    'no' => ' checked="checked"',
+                    'yes' => '',
+                );                
+                %checkedpassbackfmt = (
+                    '1p1' => ' checked="checked"',
+                    '1p0' => '',
+                );
+                if ($values{'passback'} ne '') {
+                    $passbacksty = 'inline-block';
+                    $checkedpassback{'yes'} = ' checked="checked"';
+                    $checkedpassback{'no'} = '';
+                    if ($values{'passbackformat'} eq '1.0') {
+                        $checkedpassbackfmt{'1p0'} = ' checked="checked"';
+                        $checkedpassbackfmt{'1p1'} = '';
+                    }
+                }
                 if ($ltiauth) {
                     $usersty = 'display:none';
                     $onclickrequser = ' onclick="toggleLinkProtExtra(this.form,'."'requser','optional','1','block','$i'".');"';
@@ -7405,6 +7445,19 @@
                     }
                 }
                 $datatable .= '<br /><br />'.
+                              '<span class="LC_nobreak">'.$desc{'passback'}.'?'.
+                              '<label><input type="radio" name="linkprot_passback_'.$i.'" value="0"'.
+                              $onclickpassback.$checkedpassback{'no'}.$disabled.' />'.&mt('No').'</label> '.
+                              '<label><input type="radio" name="linkprot_passback_'.$i.'" value="1"'.
+                              $onclickpassback.$checkedpassback{'yes'}.$disabled.' />'.&mt('Yes').'</label></span><br />'.
+                              '<div id="linkprot_passbackparam_'.$i.'" class="LC_floatleft" style="display:'.$passbacksty.'" />'.
+                              '<span class="LC_nobreak">'.&mt('Grade format').
+                              '<label><input type="radio" name="linkprot_passbackformat_'.$i.'" value="1.1"'.$checkedpassbackfmt{'1p1'}.' />'.
+                              &mt('Outcomes Service (1.1)').'</label>'.(' 'x2).
+                              '<label><input type="radio" name="linkprot_passbackformat_'.$i.'" value="1.0"'.$checkedpassbackfmt{'1p0'}.'/>'.
+                              &mt('Outcomes Extension (1.0)').'</label></span></div>'.
+                              '<div style="padding:0;clear:both;margin:0;border:0"></div>'.
+                              '<br />'.
                               '<span class="LC_nobreak">'.$desc{'returnurl'}.'?'.
                               '<label><input type="radio" name="linkprot_returnurl_'.$i.'" value="0"'.
                               $onclickreturnurl.$checkedreturnurl{'no'}.$disabled.' />'.&mt('No').'</label> '.
@@ -7435,7 +7488,8 @@
                   '<input type="hidden" name="linkprot_maxnum" value="'.$next.'" />'."\n".
                   '<input type="checkbox" name="linkprot_add" value="1"'.$disabled.' />'.&mt('Add').'</span></td>'."\n".
                   '<td width="100%">';
-    my ($usersty,$onclickrequser,%checkedrequser,$onclickreturnurl,%checkedreturnurl);
+    my ($usersty,$onclickrequser,%checkedrequser,$onclickreturnurl,%checkedreturnurl,
+       $onclickpassback,%checkedpassback,%checkedpassbackfmt);
     if ($ltiauth) {
         $usersty = 'display:none';
         $onclickrequser = ' onclick="toggleLinkProtExtra(this.form,'."'requser','optional','1','block','add'".');"';
@@ -7445,6 +7499,15 @@
         );
         $datatable .= '<fieldset><legend>'.$lt{'requ'}.'</legend>';
     }
+    $onclickpassback = ' onclick="toggleLinkProtExtra(this.form,'."'passback','passbackparam','1','inline-block','add'".');"';
+    %checkedpassback = (
+        'no' => ' checked="checked"',
+        'yes' => '',
+    );
+    %checkedpassbackfmt = (
+        '1p1' => ' checked="checked"',
+        '1p0' => '',
+    );
     $onclickreturnurl = ' onclick="toggleLinkProtExtra(this.form,'."'returnurl','divurlparam','1','inline-block','add'".');"';
     %checkedreturnurl = (
         no => ' checked="checked"',
@@ -7467,6 +7530,19 @@
                       '<label><input type="checkbox" name="linkprot_visible_add" id="linkprot_visible_add" onclick="if (this.checked) { this.form.linkprot_secret_add.type='."'text'".' } else { this.form.linkprot_secret_add.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label></span> '."\n";
     }
     $datatable .= '<br /><br />'.
+                  '<span class="LC_nobreak">'.$desc{'passback'}.'?'.
+                  '<label><input type="radio" name="linkprot_passback_add" value="0"'.
+                  $onclickpassback.$checkedpassback{'no'}.$disabled.' />'.&mt('No').'</label> '.
+                  '<label><input type="radio" name="linkprot_passback_add" value="1"'.
+                  $onclickpassback.$checkedpassback{'yes'}.$disabled.' />'.&mt('Yes').'</label></span>'.
+                  '<br /><div id="linkprot_passbackparam_add" class="LC_floatleft" style="display:none" />'.
+                  '<span class="LC_nobreak">'.&mt('Grade format').
+                  '<label><input type="radio" name="linkprot_passbackformat_add" value="1.1"'.$checkedpassbackfmt{'1p1'}.$disabled.' />'.
+                  &mt('Outcomes Service (1.1)').'</label>'.(' 'x2).
+                  '<label><input type="radio" name="linkprot_passbackformat_add" value="1.0"'.$checkedpassbackfmt{'1p0'}.$disabled.' />'.
+                  &mt('Outcomes Extension (1.0)').'</label></span></div>'.
+                  '<div style="padding:0;clear:both;margin:0;border:0"></div>'.
+                  '<br />'.
                   '<span class="LC_nobreak">'.$desc{'returnurl'}.'?'.
                   '<label><input type="radio" name="linkprot_returnurl_add" value="0"'.
                   $onclickreturnurl.$checkedreturnurl{'no'}.$disabled.' />'.&mt('No').'</label> '.
@@ -7499,6 +7575,7 @@
                                           'lifetime'  => 'Nonce lifetime (s)',
                                           'name'      => 'Launcher Application',
                                           'secret'    => 'Secret',
+                                          'passback'  => 'Can return grades to Launcher',
                                           'returnurl' => 'Launcher return URL',
                                           'requser'   => 'Use identity',
                                           'email'     => 'Email address',


More information about the LON-CAPA-cvs mailing list