[LON-CAPA-cvs] cvs: rat / lonwrapper.pm loncom/interface lonaboutme.pm londocs.pm lonhtmlcommon.pm lonsyllabus.pm lonviewclasslist.pm loncom/xml londefdef.pm

raeburn raeburn at source.lon-capa.org
Wed Sep 27 10:52:28 EDT 2023


raeburn		Wed Sep 27 14:52:28 2023 EDT

  Modified files:              
    /loncom/interface	lonaboutme.pm londocs.pm lonhtmlcommon.pm 
                     	lonsyllabus.pm lonviewclasslist.pm 
    /loncom/xml	londefdef.pm 
    /rat	lonwrapper.pm 
  Log:
  - No breadcrumbs trail in modal pop-up when previewing aboutme, syllabus,
    roster, and pdf documents from links in Course Editor.
  - Breadcrumbs trails for "Supplemental" and "Main" content more consistent:
    - No Main Menu link as first item if symb or folderpath available
    - No Return to Last location link/icon if symb or folderpath available
  - Don't set supplementalflag to 1 for documents uploaded to Main Content
    area which require "showdoc", so breadcrumb trail is available to students.
  
  
-------------- next part --------------
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.165 loncom/interface/lonaboutme.pm:1.166
--- loncom/interface/lonaboutme.pm:1.165	Sat May 13 20:36:27 2023
+++ loncom/interface/lonaboutme.pm	Wed Sep 27 14:52:26 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Personal Information Page
 #
-# $Id: lonaboutme.pm,v 1.165 2023/05/13 20:36:27 raeburn Exp $
+# $Id: lonaboutme.pm,v 1.166 2023/09/27 14:52:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -147,7 +147,7 @@
 # ------------------------------------------------------------ Get Query String
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                         ['forceedit','forcestudent','todocs',
-                         'register','popup','folderpath','title']);
+                         'register','popup','folderpath','title','only_body']);
 # ----------------------------------------------- Available Portfolio file display
     if (($target ne 'tex') && ($action eq 'portfolio')) {
         &display_portfolio_header($r,$is_course);
@@ -226,7 +226,9 @@
         if ($env{'form.popup'}) { # Don't show breadcrumbs in popup window 
             $args->{'no_nav_bar'} = 1;
         } elsif (!$env{'form.register'}) { #Don't show breadcrumbs twice, when this page is part of course content and you call it
-            if (($env{'request.course.id'}) &&
+            if (($env{'form.only_body'}) && ($env{'request.course.id'})) {
+                $args->{'only_body'} = 1;
+            } elsif (($env{'request.course.id'}) &&
                 ($env{'form.folderpath'} =~ /^supplemental/)) {
                 &Apache::loncommon::validate_folderpath(1,'',$coursenum,$coursedomain);
                 my $crstype = &Apache::loncommon::course_type();
@@ -239,6 +241,7 @@
                     &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
                 if (ref($brcrum) eq 'ARRAY') {
                     $args->{'bread_crumbs'} = $brcrum;
+                    $args->{'bread_crumbs_nomenu'} = 1;
                 }
             } else {
                 $args->{'bread_crumbs'} = [{href=>"/adm/$cdom/$cnum/aboutme",
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.704 loncom/interface/londocs.pm:1.705
--- loncom/interface/londocs.pm:1.704	Thu Jul 20 22:12:39 2023
+++ loncom/interface/londocs.pm	Wed Sep 27 14:52:26 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.704 2023/07/20 22:12:39 raeburn Exp $
+# $Id: londocs.pm,v 1.705 2023/09/27 14:52:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4734,7 +4734,7 @@
                 }
                 $nomodal = 1;
             }
-        } elsif (($uploaded) && (!$allowed) && ($url ne '/adm/supplemental?')) {
+        } elsif (($uploaded) && ($url ne '/adm/supplemental?') && ($url ne '/adm/coursedocs?')) {
             my $embstyle=&Apache::loncommon::fileembstyle($extension);
             unless ($embstyle eq 'ssi') {
                 if (($embstyle eq 'img')
@@ -4840,7 +4840,7 @@
 '<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" id="randomorder_'.$orderidx.'" onclick="checkForSubmit(this.form,'."'randomorder','settings'".');" '.$ro_set.$disabled.' /> '.&mt('Random Order').' </label></span>'.
 $form_end; 
         }
-    } elsif ($supplementalflag && !$allowed) {
+    } elsif ($supplementalflag) {
         my $isexttool;
         if ($url=~m{^/adm/$coursedom/$coursenum/\d+/ext\.tool$}) {
             $url='/adm/wrapper'.$url;
@@ -4935,12 +4935,20 @@
                $anchor = '#'.&HTML::Entities::encode($anchor,'"<>&');
            }
        }
-       if ((!$supplementalflag) && ($nomodal) && ($hostname ne '')) {
+       if (($nomodal) && ($hostname ne '')) {
            $link = 'http://'.$hostname.$url;
        } else {
            $link = $url;
        }
-       $link = &js_escape($link.(($url=~/\?/)?'&':'?').'inhibitmenu=yes'.$anchor);
+       my $inhibitmenu;
+       if ((($supplementalflag) && ($allowed) && ($url =~ m{^/adm/wrapper/})) ||
+           (($allowed) && (($url =~ m{^/adm/(viewclasslist|$match_domain/$match_username/aboutme)(\?|$)}) ||
+                           ($url =~ m{^/public/$match_domain/$match_courseid/syllabus(\?|$)})))) {
+           $inhibitmenu = 'only_body=1';
+       } else {
+           $inhibitmenu = 'inhibitmenu=yes';
+       }
+       $link = &js_escape($link.(($url=~/\?/)?'&':'?').$inhibitmenu.$anchor);
        if ($allowed && !$env{'request.role.adv'} && !$isfolder && !$ispage && !$uploaded) {
            if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) {
                $nolink = 1;
@@ -6059,8 +6067,11 @@
     }
     if ($env{'form.forcesupplement'}) { $supplementalflag=1; }
     if ($env{'form.forcestandard'})   { $supplementalflag=0; }
-    unless ($allowed) { $supplementalflag=1; }
-    unless ($standard) { $supplementalflag=1; }
+    unless (($supplementalflag) ||
+            ($r->uri =~ m{^/adm/coursedocs/showdoc/uploaded/\Q$coursedom\E/\Q$coursenum\E/docs/})) {
+        unless ($allowed) { $supplementalflag=1; }
+        unless ($standard) { $supplementalflag=1; }
+    }
     my $toolsflag=0;
     if ($env{'form.tools'}) { $toolsflag=1; }
 
@@ -6136,9 +6147,9 @@
             &Apache::loncommon::validate_folderpath($supplementalflag,$allowed,$coursenum,$coursedom);
         }
     }
-   
-# If we are not allowed to make changes, all we can see are supplemental docs
-    if (!$allowed) {
+ 
+# If we are not allowed to make changes and this is supplemental content set folderpath  
+    if ((!$allowed) && ($supplementalflag)) {
         unless ($env{'form.folderpath'} =~ /^supplemental/) {
             $env{'form.folderpath'} = &supplemental_base();
         }
@@ -6369,7 +6380,8 @@
         if ($supplementalflag) {
             my $title = &HTML::Entities::encode($env{'form.title'},'\'"<>&');
             my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
-            $args = {'bread_crumbs' => $brcrum};
+            $args = {'bread_crumbs' => $brcrum,
+                     'bread_crumbs_nomenu' => 1};
         } else {
             $args = {'force_register' => $showdoc};
         }
@@ -6398,8 +6410,13 @@
             }
         }
         my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype);
+        my $args = {'bread_crumbs' => $brcrum};
+        unless (($env{'form.folderpath'} eq '') ||
+                ($env{'form.folder'} eq 'supplemental')) {
+            $args->{'bread_crumbs_nomenu'} = 1;
+        }
         $r->print(&Apache::loncommon::start_page("Supplemental $crstype Content",undef,
-                                                {'bread_crumbs' => $brcrum,}));
+                                                 $args));
     } else {
         my ($breadtext,$breadtitle,$helpitem);
         $breadtext = "$crstype Editor";
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.409 loncom/interface/lonhtmlcommon.pm:1.410
--- loncom/interface/lonhtmlcommon.pm:1.409	Sun Sep 10 18:12:54 2023
+++ loncom/interface/lonhtmlcommon.pm	Wed Sep 27 14:52:26 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.409 2023/09/10 18:12:54 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.410 2023/09/27 14:52:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1737,7 +1737,11 @@
     unless ($env{'request.course.id'}) { return 0; }
     if ($env{'request.noversionuri'}=~m{^/priv/} ||
         $env{'request.uri'}=~m{^/priv/}) { return 1; }
-    return if ($env{'request.noversionuri'} eq '/adm/supplemental');
+    return if (($env{'request.noversionuri'} eq '/adm/supplemental') &&
+               ($env{'form.folder'} ne 'supplemental'));
+    return if (($env{'form.folderpath'} ne '') &&
+               (($env{'request.noversionuri'} =~ m{^/adm/$match_domain/$match_username/aboutme$}) ||
+                ($env{'request.noversionuri'} =~ m{^/public/$match_domain/$match_courseid/syllabus$})));
     return if (($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') &&
                (!$env{'request.role.adv'}));
     if (($env{'request.noversionuri'} =~ m{^/adm/viewclasslist($|\?)})
@@ -1745,6 +1749,19 @@
 
         return if ($env{'form.register'});
     }
+    if ((($env{'request.symb'} ne '') || ($env{'form.folderpath'} ne '')) &&
+         ($env{'request.noversionuri'} =~m{^/adm/coursedocs/showdoc/uploaded/($match_domain)/($match_courseid)/(docs|supplemental)/})) {
+        my ($cdom,$cnum,$area) =  ($1,$2,$3);
+        if (($env{'course.'.$env{'request.course.id'}.'.domain'} eq $cdom) &&
+            ($env{'course.'.$env{'request.course.id'}.'.num'} eq $cnum)) {
+            if (($env{'request.symb'}) && ($area eq 'docs')) {
+                my ($map,$resid,$url) = &Apache::lonnet::decode_symb($env{'request.symb'});
+                return if ($env{'request.noversionuri'} eq '/adm/coursedocs/showdoc/'.$url);
+            } elsif (($env{'form.folderpath'}) && ($area eq 'supplemental')) {
+                return;
+            }
+        }
+    }
     return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
              $env{'request.symb'} eq '')
             ||
@@ -2349,7 +2366,7 @@
             $plain=~s/\&gt\;\s*$//;
         }
         my $menulink = 0;
-        if (!$allowed && !$contenteditor) {
+        if (!$allowed && !$contenteditor && !$supplementalflag) { 
             $menulink = 1;
         }
         if ($checklinkprot) {
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.153 loncom/interface/lonsyllabus.pm:1.154
--- loncom/interface/lonsyllabus.pm:1.153	Sat Oct 29 14:47:00 2022
+++ loncom/interface/lonsyllabus.pm	Wed Sep 27 14:52:26 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Syllabus
 #
-# $Id: lonsyllabus.pm,v 1.153 2022/10/29 14:47:00 raeburn Exp $
+# $Id: lonsyllabus.pm,v 1.154 2023/09/27 14:52:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -152,8 +152,20 @@
                     &Apache::structuretags::reset_problem_globals();
                     my $oldfile = $env{'request.filename'};
                     $env{'request.filename'} = $item;
+                    my $oldinhibit;
+                    if ($env{'form.only_body'}) {
+                        $oldinhibit = $env{'form.inhibitmenu'};
+                        $env{'form.inhibitmenu'} = 'yes';
+                    }
                     my $result = &Apache::lonxml::xmlparse($r,$target,$filecontents,
                                                            '',%mystyle);
+                    if ($env{'form.only_body'}) {
+                        if ($oldinhibit ne '') {
+                            $env{'form.inhibitmenu'} = $oldinhibit;
+                        } else {
+                            delete($env{'form.inhibitmenu'});
+                        }
+                    }
                     &Apache::structuretags::reset_problem_globals();
                     &Apache::lonhomework::finished_parsing();
                     $env{'request.filename'} = $oldfile;
@@ -775,6 +787,7 @@
             &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
         if (ref($brcrum) eq 'ARRAY') {
             $args->{'bread_crumbs'} = $brcrum;
+            $args->{'bread_crumbs_nomenu'} = 1;
         }
     } else {
         if ((&Apache::lonnet::is_on_map("public/$cdom/$cnum/syllabus"))
Index: loncom/interface/lonviewclasslist.pm
diff -u loncom/interface/lonviewclasslist.pm:1.19 loncom/interface/lonviewclasslist.pm:1.20
--- loncom/interface/lonviewclasslist.pm:1.19	Tue Sep 26 19:11:02 2023
+++ loncom/interface/lonviewclasslist.pm	Wed Sep 27 14:52:27 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to display the classlist 
 #
-# $Id: lonviewclasslist.pm,v 1.19 2023/09/26 19:11:02 raeburn Exp $
+# $Id: lonviewclasslist.pm,v 1.20 2023/09/27 14:52:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -62,7 +62,8 @@
         return OK;
     }
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-                                 ['register','forceedit','action','symb','todocs']);
+                                 ['register','forceedit','action',
+                                  'symb','todocs','only_body']);
     if (! ($env{'request.course.fn'})) {
         $env{'user.error.msg'}=
             "/adm/viewclasslist:not in course role";
@@ -76,10 +77,16 @@
         $start_page = &Apache::loncommon::start_page('Classlist',undef,
                              {'force_register' => $env{'form.register'}});
     } else {
-        my $brcrum = [{'href' => 'adm/viewclasslist',
-                       'text' => 'View Classlist'},];
+        my $args = {};
+        if ($env{'form.only_body'}) {
+            $args->{'only_body'} = 1;
+        } else {
+            my $brcrum = [{'href' => 'adm/viewclasslist',
+                           'text' => 'View Classlist'},];
+            $args->{'bread_crumbs'} = $brcrum;
+        }
         $start_page = &Apache::loncommon::start_page('Classlist',undef,
-                                                     {'bread_crumbs' => $brcrum});
+                                                     $args);
     }
     $r->print(<<ENDHEADER);
 $start_page
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.472 loncom/xml/londefdef.pm:1.473
--- loncom/xml/londefdef.pm:1.472	Thu Jul 13 19:07:27 2023
+++ loncom/xml/londefdef.pm	Wed Sep 27 14:52:27 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module
 #
-# $Id: londefdef.pm,v 1.472 2023/07/13 19:07:27 raeburn Exp $
+# $Id: londefdef.pm,v 1.473 2023/09/27 14:52:27 raeburn Exp $
 #
 #
 # Copyright Michigan State University Board of Trustees
@@ -621,6 +621,9 @@
             if ($env{'request.use_absolute'}) {
                 $args->{'use_absolute'} = $env{'request.use_absolute'};
             }
+            if ($env{'form.only_body'}) {
+                $args->{'only_body'} = 1;
+            }
         }
 	$currentstring =
 	    &Apache::loncommon::start_page($Apache::londefdef::title,
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.82 rat/lonwrapper.pm:1.83
--- rat/lonwrapper.pm:1.82	Mon May 22 21:20:56 2023
+++ rat/lonwrapper.pm	Wed Sep 27 14:52:28 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Wrapper for external and binary files as standalone resources
 #
-# $Id: lonwrapper.pm,v 1.82 2023/05/22 21:20:56 raeburn Exp $
+# $Id: lonwrapper.pm,v 1.83 2023/09/27 14:52:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -95,6 +95,8 @@
     }
     if ($env{'form.only_body'}) {
         $args->{'only_body'} = $env{'form.only_body'};
+    } elsif (($is_supp) && ($env{'form.folderpath'} ne '')) {
+        $args->{'bread_crumbs_nomenu'} = 1;
     }
 
     my ($countdown,$donemsg,$headjs);
@@ -302,7 +304,7 @@
     } else {
         my $offset = 5;
         &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']);
-        if ($env{'form.inhibitmenu'} eq 'yes') {
+        if (($env{'form.inhibitmenu'} eq 'yes') || ($env{'form.only_body'})) {
             $offset = 0;
         }
         my $script = &Apache::lonhtmlcommon::scripttag(<<SCRIPT);
@@ -453,7 +455,7 @@
     }
     if (($is_ext) || ($exttool)) {
         &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-            ['forceedit','register','folderpath','symb','idx','title','anchor']);
+            ['forceedit','register','folderpath','symb','idx','title','anchor','only_body']);
         if (($env{'form.forceedit'}) &&
             (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&
             (($env{'form.folderpath'} =~ /^supplemental/) ||
@@ -498,8 +500,10 @@
                 $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
                 &Apache::loncommon::validate_folderpath(1,'',$cnum,$cdom);
             }
-            $brcrum =
-                &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
+            unless ($env{'form.only_body'}) {
+                $brcrum =
+                    &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
+            }
         }
     } elsif ($env{'request.course.id'}) {
         my $courseurl = &Apache::lonnet::courseid_to_courseurl($env{'request.course.id'});
@@ -507,7 +511,7 @@
         if ($url =~ m{^\Q/uploaded/$courseurl/supplemental/\E}) {
             $is_supp = 1;
             &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-                                                    ['folderpath','title']);
+                                                    ['folderpath','title','only_body']);
             if ($env{'form.folderpath'}) {
                 $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
                 $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -516,9 +520,10 @@
             my $title = $env{'form.title'};
             $title = &HTML::Entities::encode($title,'\'"<>&');
             my $crstype = &Apache::loncommon::course_type();
-            $brcrum =
-                &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
-
+            unless ($env{'form.only_body'}) {
+                $brcrum =
+                    &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
+            }
         }
     }
 


More information about the LON-CAPA-cvs mailing list