--- loncom/interface/londocs.pm 2010/12/07 21:34:04 1.444 +++ loncom/interface/londocs.pm 2010/12/08 02:08:21 1.445 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.444 2010/12/07 21:34:04 www Exp $ +# $Id: londocs.pm,v 1.445 2010/12/08 02:08:21 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2715,23 +2715,48 @@ sub handler { &init_breadcrumbs('exportcourse','IMS Export'); &exportcourse($r); } else { -# is this a standard course? +# +# Done catching special calls +# The whole rest is for course and supplemental documents +# Get the parameters that may be needed +# + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['folderpath','pagepath', + 'pagesymb','forcesupplement','forcestandard']); + +# standard=1: this is a "new-style" course with an uploaded map as top level +# standard=2: this is a "old-style" course, and there is nothing we can do my $standard=($env{'request.course.uri'}=~/^\/uploaded\//); - my $forcestandard = 0; - my $forcesupplement; + +# Decide whether this should display supplemental or main content +# supplementalflag=1: show supplemental documents +# supplementalflag=0: show standard documents + + + my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/); + if (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'} eq "" || ($env{'form.pagepath'})) { + $supplementalflag=0; + } + if ($env{'form.forcesupplement'}) { $supplementalflag=1; } + if ($env{'form.forcestandard'}) { $supplementalflag=0; } + unless ($allowed) { $supplementalflag=1; } + unless ($standard) { $supplementalflag=1; } + my $script=''; my $showdoc=0; my $containertag; my $uploadtag; - - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['folderpath','pagepath', - 'pagesymb','forcesupplement','forcestandard']); +# Where do we store these for when we come back? + my $stored_folderpath='docs_folderpath'; + if ($supplementalflag) { + $stored_folderpath='docs_sup_folderpath'; + } + # No folderpath, no pagepath, see if we have something stored if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) { - &Apache::loncommon::restore_course_settings('docs_folderpath', + &Apache::loncommon::restore_course_settings($stored_folderpath, {'folderpath' => 'scalar'}); } if (!$allowed) { @@ -2740,7 +2765,7 @@ sub handler { } } if (!$env{'form.folderpath'} && $allowed) { - &Apache::loncommon::restore_course_settings('docs_folderpath', + &Apache::loncommon::restore_course_settings($stored_folderpath, {'pagepath' => 'scalar'}); } if ($env{'form.pagepath'}) { @@ -2751,9 +2776,12 @@ sub handler { &escape(&mt('Supplemental '.$crstype.' Documents')).'&'. $env{'form.folderpath'}; } - &Apache::loncommon::store_course_settings('docs_folderpath', +# Store this + if ($allowed) { + &Apache::loncommon::store_course_settings($stored_folderpath, {'pagepath' => 'scalar', 'folderpath' => 'scalar'}); + } if ($env{'form.folderpath'}) { my (@folderpath)=split('&',$env{'form.folderpath'}); $env{'form.foldername'}=&unescape(pop(@folderpath)); @@ -2787,12 +2815,6 @@ sub handler { if ($showdoc) { # got called in sequence from course $allowed=0; } else { - if (($env{'form.folder'}=~/^(?:group|default)_/) || - ($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) { - $forcestandard = 1; - } - $forcesupplement=($env{'form.folder'}=~/^supplemental_/); - if ($allowed) { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']); $script=&Apache::lonratedt::editscript('simple'); @@ -2962,8 +2984,6 @@ CHBO $checkbox FUFORM - #$list .= Apache::lonhtmlcommon::htmltag('li', $picture.' '.$button->{$picture}, {class => 'LC_menubuttons_inline_text'}); - #$fileuploadform .= create_form_ul(create_list_elements(@fileuploada)); $fileuploadform .= &create_form_ul(&Apache::lonhtmlcommon::htmltag('li',$fileuploada,{class => 'LC_menubuttons_inline_text'})).''; my $simpleeditdefaultform=(<