[LON-CAPA-cvs] cvs: loncom /auth lonlinkexit.pm /interface lonmenu.pm

raeburn raeburn at source.lon-capa.org
Thu Jul 7 11:28:08 EDT 2022


raeburn		Thu Jul  7 15:28:08 2022 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
    /loncom/auth	lonlinkexit.pm 
  Log:
  - Bug 6907
    Value of deeplink parameter in effect for session launched via deep-link
    determines if "Exit Tool" button is present in inline menu, the text used
    for the button and whether redirect to a URL can occur when pushed.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.525 loncom/interface/lonmenu.pm:1.526
--- loncom/interface/lonmenu.pm:1.525	Fri Jul  1 03:14:31 2022
+++ loncom/interface/lonmenu.pm	Thu Jul  7 15:28:08 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.525 2022/07/01 03:14:31 raeburn Exp $
+# $Id: lonmenu.pm,v 1.526 2022/07/07 15:28:08 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3226,10 +3226,17 @@
                         exit     => 'Cancel',
                     );
                     if ($exit) {
-                        my $height = 250;
-                        my $width = 300;
-                        my $exitbuttontext = &mt('Exit Tool');
-                        return <<END;
+                        my ($show,$text) = split(/:/,$exit);
+                        unless ($show eq 'no') { 
+                            my $height = 250;
+                            my $width = 300;
+                            my $exitbuttontext;
+                            if ($text eq '') { 
+                                $exitbuttontext = &mt('Exit Tool');
+                            } else {
+                                $exitbuttontext = $text;
+                            }
+                            return <<END;
 <form method="post" name="LCexitButton" action="/adm/linkexit">
     <input type="hidden" name="LC_deeplink_exit" value="" />
     <button id="LC_exit-confirm-opener" type="button">$exitbuttontext</button>
@@ -3271,6 +3278,7 @@
 </script>
 
 END
+                        }
                     }
                 }
             }
Index: loncom/auth/lonlinkexit.pm
diff -u loncom/auth/lonlinkexit.pm:1.1 loncom/auth/lonlinkexit.pm:1.2
--- loncom/auth/lonlinkexit.pm:1.1	Thu Jun 30 21:04:13 2022
+++ loncom/auth/lonlinkexit.pm	Thu Jul  7 15:28:08 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Re-launch guidance for deep linked access with username mismatch
 #
-# $Id: lonlinkexit.pm,v 1.1 2022/06/30 21:04:13 raeburn Exp $
+# $Id: lonlinkexit.pm,v 1.2 2022/07/07 15:28:08 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,6 +33,7 @@
 use Apache::Constants qw(:common);
 use Apache::lonnet;
 use Apache::loncommon;
+use Apache::lonnavmaps;
 use Apache::lonlocal;
 use LONCAPA;
 use CGI::Cookie();
@@ -49,9 +50,36 @@
             if ($env{'request.deeplink.target'} ne '') {
                 $deeplinktarget = $env{'request.deeplink.target'};
             }
-            if ($env{'request.linkprotexit'} =~ m{^https?://}) {
-                $exiturl = $env{'request.linkprotexit'};
-                &js_escape(\$exiturl);
+            if ($env{'request.course.id'}) { 
+                my ($deeplink_symb,$deeplink);
+                my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+                my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+                if (($cnum ne '') && ($cdom ne '')) {
+                    $deeplink_symb = &Apache::loncommon::deeplink_login_symb($cnum,$cdom);
+                    if ($deeplink_symb) {
+                        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');
+                            }
+                        } else {
+                            $deeplink = &Apache::lonnet::EXT('resource.0.deeplink',$deeplink_symb);
+                        }
+                        if ($deeplink ne '') {
+                            my ($state,$others,$listed,$scope,$protect,$display,$target,$exit) = split(/,/,$deeplink);
+                            if ($exit) {
+                                my ($show,$text) = split(/:/,$exit);
+                                if ($show eq 'url') {
+                                    if ($env{'request.linkprotexit'} =~ m{^https?://}) {
+                                        $exiturl = $env{'request.linkprotexit'};
+                                        &js_escape(\$exiturl);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
             }
         }
         if (unlink("$lonidsdir/$handle.id")) {




More information about the LON-CAPA-cvs mailing list