--- loncom/interface/londocs.pm 2023/07/20 22:12:39 1.704 +++ loncom/interface/londocs.pm 2024/01/08 18:17:50 1.708 @@ -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.708 2024/01/08 18:17:50 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4734,7 +4734,7 @@ END } $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 @@ $form_common."\n". ''. $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 @@ $form_end; $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; @@ -5884,7 +5892,9 @@ sub handler { 'Load_Map','Supplemental','Score_Upload_Form', 'Adding_Pages','Importing_LON-CAPA_Resource', 'Importing_IMS_Course','Uploading_From_Harddrive', - 'Course_Roster','Web_Page','Dropbox','Simple_Problem') { + 'Course_Roster','Web_Page','Dropbox','Simple_Problem', + 'Standard_Problem','Course_Resources', + 'Search_LON-CAPA_Resource','Import_Stored_Links') { $help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic); } # Composite help files @@ -6059,8 +6069,11 @@ sub handler { } 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 +6149,9 @@ sub handler { &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) { + +# Set folderpath if we are not allowed to make changes and this is supplemental content + if ((!$allowed) && ($supplementalflag)) { unless ($env{'form.folderpath'} =~ /^supplemental/) { $env{'form.folderpath'} = &supplemental_base(); } @@ -6369,7 +6382,8 @@ sub handler { 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 +6412,13 @@ sub handler { } } 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"; @@ -6484,7 +6503,7 @@ sub handler { if ($allowed && $toolsflag) { $r->print(&startContentScreen('tools')); - $r->print(&generate_admin_menu($crstype,$canedit)); + $r->print(&generate_admin_menu($crstype,$canedit,$coursenum,$coursedom)); $r->print(&endContentScreen()); } elsif ((!$showdoc) && (!$uploadphase)) { # ----------------------------------------------------------------------------- @@ -6492,8 +6511,8 @@ sub handler { 'copm' => 'All documents out of a published map into this folder', 'upfi' => 'Upload File', 'upld' => 'Upload Content', - 'srch' => 'Search', - 'impo' => 'Import', + 'srch' => 'Search Repository', + 'impo' => 'Import from Repository', 'lnks' => 'Import from Stored Links', 'impm' => 'Import from Assembled Map', 'imcr' => 'Import from Course Resources', @@ -6670,13 +6689,22 @@ FUFORM SEDFFORM - my $importcrsresform; - my ($numdirs,$pickfile) = - &Apache::loncommon::import_crsauthor_form('coursepath','coursefile', - "resize_scrollbox('contentscroll','1','0');", - undef,'res'); - if ($pickfile) { - $importcrsresform=(< $lt{'imcr'}$help{'Course_Resources'}
@@ -6699,6 +6727,7 @@ SEDFFORM
CRSFORM + } } my $fromstoredjs; @@ -6709,13 +6738,13 @@ CRSFORM } my @importpubforma = ( - { ''.$lt{srch}.'' => $pathitem."$lt{'srch'}" }, + { ''.$lt{srch}.'' => $pathitem."$lt{'srch'}$help{'Search_LON-CAPA_Resource'}" }, { ''.$lt{impo}.'' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" }, - { ''.$lt{lnks}.'' => ''.$lt{'lnks'}.'' }, + { ''.$lt{lnks}.'' => ''.$lt{'lnks'}.''.$help{'Import_Stored_Links'} }, { ''.$lt{impm}.'' => $importpubform }, ); - if ($pickfile) { - push(@importpubforma,{ ''.$lt{imcr}.'' => $importcrsresform}); + if ($importcrsresform) { + push(@importpubforma,{ ''.$lt{imcr}.'' => $importcrsresform}); } $importpubform = &create_form_ul(&create_list_elements(@importpubforma)); my $extresourcesform = @@ -6967,13 +6996,14 @@ NWEBFORM } } } - $pickdir .= ''."\n". - '
'."\n". + if ($checkcrsres) { + $pickdir .= ''."\n"; + } + $pickdir .= '
'."\n". $lt{'dire'}. '
'."\n"; - my %seltemplate_menus; my @files = &Apache::lonhomework::get_template_list('problem'); my @noexamplelink = ('blank.problem','blank.library','script.library'); @@ -7014,9 +7044,11 @@ NWEBFORM "toggleExampleText();",'template').'
'; my $templatepreview = ''. ''.&mt('Example').''; - my $crsresform=(< - $lt{'stpr'}$help{'Course_Resource'} + $lt{'stpr'}$help{'Standard_Problem'}