[LON-CAPA-cvs] cvs: rat /client parameter.html loncom/auth lonlogout.pm lonroles.pm loncom/interface loncommon.pm lonhelpmenu.pm lonhtmlcommon.pm lonmenu.pm lonparmset.pm lontiny.pm

raeburn raeburn at source.lon-capa.org
Tue May 24 12:23:04 EDT 2022


raeburn		Tue May 24 16:23:04 2022 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonhelpmenu.pm lonhtmlcommon.pm 
                     	lonmenu.pm lonparmset.pm lontiny.pm 
    /loncom/auth	lonlogout.pm lonroles.pm 
    /rat/client	parameter.html 
  Log:
  - Bug 6907 option to stop deep-linked items escaping iframe context.
    Seventh component (target) added to the deeplink parameter.
    Launch of deep-link (i.e. a tiny URL) sets $env{'request.deeplink.target'}. 
  
  
-------------- next part --------------
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1377 loncom/interface/loncommon.pm:1.1378
--- loncom/interface/loncommon.pm:1.1377	Wed Feb 16 16:28:49 2022
+++ loncom/interface/loncommon.pm	Tue May 24 16:23:03 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1377 2022/02/16 16:28:49 raeburn Exp $
+# $Id: loncommon.pm,v 1.1378 2022/05/24 16:23:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1310,6 +1310,9 @@
     if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
         $target = '';
     }
+    if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
+        $target = ' target="'.$env{'request.deeplink.target'}.'"';
+    }
     if ($text ne "") {	
 	$template.='<span class="LC_help_open_topic">'
                   .'<a'.$target.' href="'.$link.'">'
@@ -1520,6 +1523,9 @@
     if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
         $target = '';
     }
+    if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
+        $target = ' target="'.$env{'request.deeplink.target'}.'"';
+    }
     # Add the text
     if ($text ne "")
     {
@@ -6269,6 +6275,10 @@
         $target = '';
         $crumbtarget = '';
     }
+    if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
+        $target = ' target="'.$env{'request.deeplink.target'}.'"';
+        $crumbtarget = $env{'request.deeplink.target'};
+    }
 
     my $output =
          '<div>'
@@ -9454,7 +9464,7 @@
                 }
             }
             if ($deeplink ne '') {
-                my ($state,$others,$listed,$scope,$protect,$display) = split(/,/,$deeplink);
+                my ($state,$others,$listed,$scope,$protect,$display,$target) = split(/,/,$deeplink);
                 if ($display =~ /^\d+$/) {
                     $deeplinkmenu = 1;
                     $menucoll = $display;
Index: loncom/interface/lonhelpmenu.pm
diff -u loncom/interface/lonhelpmenu.pm:1.46 loncom/interface/lonhelpmenu.pm:1.47
--- loncom/interface/lonhelpmenu.pm:1.46	Tue May  8 01:19:06 2018
+++ loncom/interface/lonhelpmenu.pm	Tue May 24 16:23:03 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # generate frame-based help system
 #
-# $Id: lonhelpmenu.pm,v 1.46 2018/05/08 01:19:06 raeburn Exp $
+# $Id: lonhelpmenu.pm,v 1.47 2022/05/24 16:23:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -184,6 +184,9 @@
     if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
         $target = '_parent';
     }
+    if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) {
+        $target = '_parent';
+    }
     my %items = (
                     general => {
                                  href => '/adm/help/'.$general_help.'.hlp',
@@ -400,6 +403,9 @@
     if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
         $target = '_parent';
     }
+    if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) {
+        $target = '_parent';
+    }
     if ($stayOnPage) {
         $r->print('<div>');
     } 
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.400 loncom/interface/lonhtmlcommon.pm:1.401
--- loncom/interface/lonhtmlcommon.pm:1.400	Tue Oct 26 02:31:22 2021
+++ loncom/interface/lonhtmlcommon.pm	Tue May 24 16:23:03 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.400 2021/10/26 02:31:22 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.401 2022/05/24 16:23:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -82,6 +82,9 @@
        if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
            $target ='';
        }
+       if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
+           $target = ' target="'.$env{'request.deeplink.target'}.'"';
+       }
        return '<a'.$target.' href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'"><span class="LC_setting">'.$text.'</span></a>';
    } else {
       return '';
@@ -109,6 +112,9 @@
         if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
             $target='';
         }
+        if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
+            $target = ' target="'.$env{'request.deeplink.target'}.'"';
+        }
         return "<a".$target." href=\"/adm/parmset?symb=$symb&filter=$filter&part=$part\"><span class=\"LC_setting\">$linktext</span></a>";
     } else {
         return $linktext;
@@ -1948,6 +1954,9 @@
             if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
                 $target='';
             }
+            if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
+                $target = $env{'request.deeplink.target'};
+            }
             $menulink =  {  href   =>'/adm/menu',
                             title  =>'Go to main menu',
                             target =>$target,
@@ -1973,6 +1982,9 @@
                 if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
                     $hashref->{'target'} = '';
                 }
+                if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
+                    $hashref->{'target'} = $env{'request.deeplink.target'};
+                }
             }
             $links=&htmltag( 'a','<img src="/res/adm/pages/tolastloc.png" alt="'.$alttext.'" class="LC_icon" />',
                              $hashref);
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.515 loncom/interface/lonmenu.pm:1.516
--- loncom/interface/lonmenu.pm:1.515	Fri May  6 19:36:09 2022
+++ loncom/interface/lonmenu.pm	Tue May 24 16:23:03 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.515 2022/05/06 19:36:09 raeburn Exp $
+# $Id: lonmenu.pm,v 1.516 2022/05/24 16:23:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -99,7 +99,7 @@
 
 =over
 
-=item prep_menuitems(\@menuitem,$ltitarget)
+=item prep_menuitems(\@menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr)
 
 This routine wraps a menuitem in proper HTML. It is used by primary_menu() and 
 secondary_menu().
@@ -220,7 +220,7 @@
 my @inlineremote;
 
 sub prep_menuitem {
-    my ($menuitem,$ltitarget,$listclass,$linkattr) = @_;
+    my ($menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr) = @_;
     return '' unless(ref($menuitem) eq 'ARRAY');
     my $link;
     if ($$menuitem[1]) { # graphical Link
@@ -233,6 +233,8 @@
     my $target = ' target="_top"';
     if ($ltitarget eq 'iframe') {
         $target ='';
+    } elsif ($deeplinktarget eq '_self') {
+        $target = $deeplinktarget;
     }
     return ($listclass?'<li class="'.$listclass.'">':'<li>').'<a'
            # highlighting for new messages
@@ -265,7 +267,7 @@
         my %roles_in_env;
         $rolecount = &Apache::lonroles::roles_from_env(\%roles_in_env,$update);
     }
-    my ($lti,$ltitarget);
+    my ($lti,$ltitarget,$deeplinktarget);
     if ($env{'request.lti.login'}) {
         $lti = 1;
         $ltitarget = $env{'request.lti.target'};
@@ -277,6 +279,9 @@
             }
         }
     }
+    if ($env{'request.deeplink.login'}) {
+        $deeplinktarget = $env{'request.deeplink.target'};
+    }
     if (($menucoll) && (ref($menuref) eq 'HASH')) {
         %menuopts = %{$menuref};
     }
@@ -341,7 +346,7 @@
             my ($link,$target);
             if ($menuitem->[0] ne '') {
                 $link = $menuitem->[0];
-                unless ($ltitarget eq 'iframe') {
+                unless (($ltitarget eq 'iframe') || ($deeplinktarget eq '_self')) {
                     $target = '_top';
                 }
             } else {
@@ -391,7 +396,7 @@
                                                                   'helpdeskmail',
                                                                   $defdom,$origmail);
                 if ($to ne '') {
-                    $menu{$position} .= &prep_menuitem($menuitem,$ltitarget,$listclass,$linkattr); 
+                    $menu{$position} .= &prep_menuitem($menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr); 
                 }
             } else {
                 $menu{$position} .= ($listclass?'<li class="'.$listclass.'">':'<li>').
@@ -404,9 +409,9 @@
                     $$menuitem[0] = '/adm/login';
                 }
             }
-            $menu{$position} .= prep_menuitem($menuitem,$ltitarget,$listclass,$linkattr);
+            $menu{$position} .= prep_menuitem($menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr);
         } else {
-            $menu{$position} .= prep_menuitem($menuitem,$ltitarget,$listclass,$linkattr);
+            $menu{$position} .= prep_menuitem($menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr);
         }
     }
     my @output = ('','');
@@ -537,10 +542,13 @@
         }
     }
 
-    my ($roleswitcher_js,$roleswitcher_form,$ltitarget);
+    my ($roleswitcher_js,$roleswitcher_form,$ltitarget,$deeplinktarget);
     if ($env{'request.lti.login'}) {
         $ltitarget = $env{'request.lti.target'};
     }
+    if ($env{'request.deeplink.login'}) {
+        $deeplinktarget = $env{'request.deeplink.target'};
+    }
 
     foreach my $menuitem (@secondary_menu) {
         # evaluate conditions 
@@ -598,7 +606,7 @@
             my ($link,$target);
             if ($menuitem->[0] ne '') {
                 $link = $menuitem->[0];
-                unless ($ltitarget eq 'iframe') {
+                unless (($ltitarget eq 'iframe') || ($deeplinktarget eq '_self')) {
                     $target = '_top';
                 }
             } else {
@@ -649,7 +657,7 @@
                 &roles_selector(
                     $env{'course.' . $env{'request.course.id'} . '.domain'},
                     $env{'course.' . $env{'request.course.id'} . '.num'},
-                    $httphost,$ltitarget
+                    $httphost
                 );
             if (($$menuitem[5]) && (!$menuopts{$$menuitem[5]})) {
                 next unless ($has_opa_priv);
@@ -683,7 +691,7 @@
                 }
                 $$menuitem[0] = &HTML::Entities::encode($$menuitem[0],'&<>"');
             }
-            $menu .= &prep_menuitem(\@$menuitem,$ltitarget,$listclass,$linkattr);
+            $menu .= &prep_menuitem(\@$menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr);
         }
     }
     if ($menu =~ /\[url\].*\[symb\]/) {
@@ -2235,10 +2243,13 @@
 
     my $countdown = &countdown_toggle_js();
 
-    my $ltitarget;
+    my ($ltitarget,$deeplinktarget);
     if ($env{'request.lti.login'}) {
         $ltitarget = $env{'request.lti.target'};
     }
+    if ($env{'request.deeplink.login'}) {
+        $deeplinktarget = $env{'request.deeplink.target'};
+    }
 
     my $annotateurl = '/adm/annotation';
     if ($httphost) {
@@ -2455,6 +2466,9 @@
     unless (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
         $target = ' target="_top"';
     }
+    if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) {
+        $target = ' target="_self"';
+    }
     return(<<ENDSERVERFORM);
 <form name="server" action="/adm/logout" method="post"$target>
 <input type="hidden" name="postdata" value="none" />
@@ -2467,7 +2481,8 @@
 
 sub constspaceform {
     my ($target,$printtarget);
-    unless (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
+    unless ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
+            (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
         $target = ' target="_top"';
         $printtarget = ' target="_parent"';
     }
@@ -2504,7 +2519,7 @@
 }
 
 sub roles_selector {
-    my ($cdom,$cnum,$httphost,$ltitarget) = @_;
+    my ($cdom,$cnum,$httphost) = @_;
     my $crstype = &Apache::loncommon::course_type();
     my $now = time;
     my (%courseroles,%seccount,%courseprivs,%roledesc);
@@ -2676,7 +2691,7 @@
             }
         }
         if (@submenu > 0) {
-            $switcher = &create_submenu('','',&mt('Switch role'),\@submenu,'','',$ltitarget);
+            $switcher = &create_submenu('','',&mt('Switch role'),\@submenu);
         }
     }
     return ($js,$form,$switcher,$has_opa_priv);
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.612 loncom/interface/lonparmset.pm:1.613
--- loncom/interface/lonparmset.pm:1.612	Tue May  3 23:46:33 2022
+++ loncom/interface/lonparmset.pm	Tue May 24 16:23:03 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.612 2022/05/03 23:46:33 raeburn Exp $
+# $Id: lonparmset.pm,v 1.613 2022/05/24 16:23:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1252,6 +1252,7 @@
     var dlKeyRegExp = /^deeplink_key_/;
     var dlMenusRegExp = /^deeplink_menus_/;
     var dlCollsRegExp = /^deeplink_colls_/;
+    var dlTargetRegExp = /^deeplink_target_/;
     var patternIP = /[\[\]\*\.a-zA-Z\d\-]+/;
     if ((document.parmform.elements.length != 'undefined')  && (document.parmform.elements.length) != 'null') {
         if (document.parmform.elements.length) {
@@ -1406,6 +1407,17 @@
                             }
                             document.parmform.elements['set_'+identifier].value += posslinkmenu;
                         }
+                    } else if (dlTargetRegExp.text(name)) {
+                        var identifier =  name.replace(dlTargetExp,'');
+                        var idx = document.parmform.elements[i].selectedIndex;
+                        if (idx > 0) {
+                            var possdeeplink = document.parmform.elements[i].options[idx].value
+                            possdeeplink = possdeeplink.replace(/^\s+|\s+$/g,'');
+                            if (document.parmform.elements['set_'+identifier].value) {
+                                possdeeplink = ','+possdeeplink;
+                            }
+                            document.parmform.elements['set_'+identifier].value += possdeeplink; 
+                        }
                     }
                 }
             }
@@ -5156,7 +5168,7 @@
     my ($thiskey, $showval, $readonly) = @_;
     my (@components,%values, at current,%titles,%options,%optiontext,%defaults,
         %selectnull,%domlti,%crslti, at possmenus);
-    @components = ('state','others','listing','scope','protect','menus');
+    @components = ('state','others','listing','scope','protect','menus','target');
     %titles = &Apache::lonlocal::texthash (
                   state   => 'Access status',
                   others  => 'Hide other resources',
@@ -5164,6 +5176,7 @@
                   scope   => 'Access scope for link',
                   protect => 'Link protection',
                   menus   => 'Menu Items Displayed',
+                  target  => 'Embedded?',
               );
     %options = (
                    state   => ['only','off','both'],
@@ -5172,6 +5185,7 @@
                    scope   => ['res','map','rec'],
                    protect => ['none','key','ltid','ltic'],
                    menus   => ['std','colls'],
+                   target  => ['_self','_top'],
                );
     %optiontext = &Apache::lonlocal::texthash (
                     only       => 'deep only',
@@ -5193,6 +5207,8 @@
                     ltid       => 'LTI access (domain)' ,
                     std        => 'Standard (all menus)',
                     colls      => 'Numbered collection',
+                    _self      => 'Embedded', 
+                    _top       => 'Not embedded',
                   );
     %selectnull = &Apache::lonlocal::texthash (
                     ltic => 'Select Launcher',
@@ -5208,6 +5224,7 @@
         ($values{'scope'}) = ($current[3] =~ /^(res|map|rec)$/);
         ($values{'protect'}) = ($current[4] =~ /^(key:[a-zA-Z\d_.!\@#\$%^&*()+=-]+|ltic:\d+|ltid:\d+)$/);
         ($values{'menus'}) = ($current[5] =~ /^(\d+)$/);
+        ($values{'target'}) = ($current[6] =~ /^(_self|_top)$/);
     } else {
         $defaults{'state'} = 'off',
         $defaults{'others'} = 'unhide',
@@ -5215,6 +5232,7 @@
         $defaults{'scope'} = 'res';
         $defaults{'protect'} = 'none';
         $defaults{'menus'} = '0';
+        $defaults{'target'} = '_top';
     }
     my $disabled;
     if ($readonly) {
@@ -5396,7 +5414,7 @@
              => [['_allowfrom_','Hostname(s), or IP(s) from which access is allowed'],
                  ['_denyfrom_','Hostname(s) or IP(s) from which access is disallowed']], 
      'string_deeplink'
-             => [['on','Set choices for link protection, resource listing, access scope, and shown menu items']],
+             => [['on','Set choices for link protection, resource listing, access scope, shown menu items, and embedding']],
     );
    
 
@@ -5407,7 +5425,7 @@
               => [['_allowfrom_','[^\!]+'],
                   ['_denyfrom_','\!']],
          'string_deeplink'
-              => [['on','^(only|off|both)\,(hide|unhide)\,(full|absent|grades|details|datestatus)\,(res|map|rec)\,(none|key\:\w+|ltic\:\d+|ltid\:\d+)\,(\d+|)$']],
+              => [['on','^(only|off|both)\,(hide|unhide)\,(full|absent|grades|details|datestatus)\,(res|map|rec)\,(none|key\:\w+|ltic\:\d+|ltid\:\d+)\,(\d+|)\,_(self|top)$']],
     );
 
 my %stringtypes = (
Index: loncom/interface/lontiny.pm
diff -u loncom/interface/lontiny.pm:1.8 loncom/interface/lontiny.pm:1.9
--- loncom/interface/lontiny.pm:1.8	Wed Nov  3 01:04:03 2021
+++ loncom/interface/lontiny.pm	Tue May 24 16:23:04 2022
@@ -2,7 +2,7 @@
 # Extract domain, courseID, and symb from a shortened URL,
 # and switch role to a role in designated course.
 #
-# $Id: lontiny.pm,v 1.8 2021/11/03 01:04:03 raeburn Exp $
+# $Id: lontiny.pm,v 1.9 2022/05/24 16:23:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -317,7 +317,7 @@
     }
     if ($deeplink ne '') {
         my $disallow;
-        my ($state,$others,$listed,$scope,$protect) = split(/,/,$deeplink);
+        my ($state,$others,$listed,$scope,$protect,$display,$target) = split(/,/,$deeplink);
         if (($protect ne 'none') && ($protect ne '')) {
             my ($acctype,$item) = split(/:/,$protect);
             if ($acctype =~ /lti(c|d)$/) {
@@ -360,6 +360,9 @@
                 }
             }
             &Apache::lonnet::appenv({'request.deeplink.login' => $linkuri});
+            if ($target ne '') {
+                &Apache::lonnet::appenv({'request.deeplink.target' => $target});
+            }
         }
     } else {
         if ($linkprotector) {
Index: loncom/auth/lonlogout.pm
diff -u loncom/auth/lonlogout.pm:1.57 loncom/auth/lonlogout.pm:1.58
--- loncom/auth/lonlogout.pm:1.57	Fri Dec 18 15:23:03 2020
+++ loncom/auth/lonlogout.pm	Tue May 24 16:23:04 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Logout Handler
 #
-# $Id: lonlogout.pm,v 1.57 2020/12/18 15:23:03 raeburn Exp $
+# $Id: lonlogout.pm,v 1.58 2022/05/24 16:23:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -186,7 +186,8 @@
 		    ($env{'request.sso.login'} ? 'roles': 'login?domain='.$domain);
             }
             $relogmessage.='<p>'.&mt('You have been successfully logged out.');
-            unless (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
+            unless ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
+                    (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
                 $relogmessage.=' '.&mt('You can [_1]close this window[_2] now.',
                                        '',''); # ,'<a href="javascript:self.close();">','</a>');
             }
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.362 loncom/auth/lonroles.pm:1.363
--- loncom/auth/lonroles.pm:1.362	Thu Feb 24 15:06:48 2022
+++ loncom/auth/lonroles.pm	Tue May 24 16:23:04 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.362 2022/02/24 15:06:48 raeburn Exp $
+# $Id: lonroles.pm,v 1.363 2022/05/24 16:23:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -899,6 +899,9 @@
                                         ($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) {
                                         &process_lti($r,$cdom,$cnum);
                                     }
+                                    if ($env{'request.deeplink.login'}) {
+                                        &set_deeplink_target($cnum,$cdom);
+                                    }
                                     $msg = '<p>'.&mt('Entering [_1] ...',
                                                      $env{'course.'.$cdom.'_'.$cnum.'.description'}).
                                            '</p>';
@@ -930,6 +933,9 @@
                                     ($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) {
                                     &process_lti($r,$cdom,$cnum);
                                 }
+                                if ($env{'request.deeplink.login'}) {
+                                    &set_deeplink_target($cnum,$cdom);
+                                }
 				# Check to see if the user is a CC entering a course 
 				# for the first time
 				if ((($role eq 'cc') || ($role eq 'co')) 
@@ -3548,6 +3554,32 @@
     }
 }
 
+sub set_deeplink_target {
+    my ($cnum,$cdom) = @_;
+    if (($cnum ne '') && ($cdom ne '')) {
+        my $deeplink_symb = &Apache::loncommon::deeplink_login_symb($cnum,$cdom);
+        if ($deeplink_symb ne '') {
+            my $deeplink;
+            if ($deeplink_symb =~ /\.(page|sequence)$/) {
+                my $mapname = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($deeplink_symb))[2]);
+                my $navmap = Apache::lonnavmaps::navmap->new();
+                if (ref($navmap)) {
+                    $deeplink = $navmap->get_mapparam(undef,$mapname,'0.deeplink');
+                }
+            } elsif ($deeplink_symb ne '') {
+                $deeplink = &Apache::lonnet::EXT('resource.0.deeplink',$deeplink_symb);
+            }
+            if ($deeplink ne '') {
+                my ($state,$others,$listed,$scope,$protect,$display,$target) = split(/,/,$deeplink);
+                if ($target ne '') {
+                    &Apache::lonnet::appenv({'request.deeplink.target' => $target});
+                }
+            }
+        }
+    }
+    return;
+}
+
 1;
 __END__
 
Index: rat/client/parameter.html
diff -u rat/client/parameter.html:1.86 rat/client/parameter.html:1.87
--- rat/client/parameter.html:1.86	Wed Aug  4 19:59:12 2021
+++ rat/client/parameter.html	Tue May 24 16:23:04 2022
@@ -5,7 +5,7 @@
 The LearningOnline Network with CAPA
 Parameter Input Window
 //
-// $Id: parameter.html,v 1.86 2021/08/04 19:59:12 raeburn Exp $
+// $Id: parameter.html,v 1.87 2022/05/24 16:23:04 raeburn Exp $
 //
 // Copyright Michigan State University Board of Trustees
 //
@@ -476,6 +476,8 @@
             }
         }
     }
+    svalue += ',';
+    svalue += sform.deeplinktarget.options[sform.deeplinktarget.selectedIndex].value;
     assemble();
 }
 
@@ -1224,6 +1226,10 @@
            deeplinkscopetxt = ['resource only','enclosing map/folder','recursive map/folder'];
            var deeplinkprotect = new Array();
            deeplinkprotect = ['none','key','ltic','ltid'];
+           var deeplinktarget = new Array();
+           deeplinktarget = ['_self','_top'];
+           var deeplinktargettxt = new Array();
+           deeplinktargettxt = ['Embedded','Not embedded'];
            tablestart('Deep-linked items');
            choicewrite('<tr><td>Access status?</td><td>');
            choicewrite('<select name="deeplinkstate">');
@@ -1404,6 +1410,17 @@
                }
                choicewrite('</select></div></span><br />');
            }
+           choicewrite('</td></tr>');
+           choicewrite('<tr><td>Embedded?</td><td>');
+           choicewrite('<select name="deeplinktarget">');
+           for (var i=0; i<deeplinktarget.length; i++) {
+               choicewrite('<option value="'+deeplinktarget[i]+'"');
+               if (deeplinkvals[6] == deeplinktarget[i]) {
+                   choicewrite(' selected="selected"');
+               }
+               choicewrite('>'+deeplinktargettxt[i]+'</option>');
+           }
+           choicewrite('</select>');
            choicewrite('</td></tr></table>');
        }
    }


More information about the LON-CAPA-cvs mailing list