version 1.464, 2011/11/27 20:55:58
|
version 1.468, 2011/12/21 20:21:49
|
Line 2845 sub handler {
|
Line 2845 sub handler {
|
# |
# |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['folderpath','pagepath', |
['folderpath','pagepath', |
'pagesymb','forcesupplement','forcestandard']); |
'pagesymb','forcesupplement','forcestandard', |
|
'symb','command']); |
|
|
# standard=1: this is a "new-style" course with an uploaded map as top level |
# 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 |
# standard=2: this is a "old-style" course, and there is nothing we can do |
Line 2873 sub handler {
|
Line 2874 sub handler {
|
my $uploadtag; |
my $uploadtag; |
|
|
# Do we directly jump somewhere? |
# Do we directly jump somewhere? |
|
|
if ($env{'form.command'} eq 'direct') { |
if ($env{'form.command'} eq 'direct') { |
(my $mapurl) = &Apache::lonnet::decode_symb($env{'form.symb'}); |
my ($mapurl,$id,$resurl); |
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
if ($env{'form.symb'} eq '') { |
$mapurl=~s{^.*/([^/]+)\.\w+$}{$1}; |
$mapurl = $env{'course.'.$env{'request.course.id'}.'.url'}; |
$env{'form.folderpath'}= |
} else { |
'default&'.&Apache::lonhtmlcommon::entity_encode('Main Course Documents'). |
($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'}); |
'&default&...::::&'. |
if ($resurl=~/\.(sequence|page)$/) { |
&Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
$mapurl=$resurl; |
&Apache::lonhtmlcommon::entity_encode($maptitle).'::::'; |
} elsif ($resurl eq 'adm/navmaps') { |
|
$mapurl=$env{'course.'.$env{'request.course.id'}.'.url'}; |
|
} |
|
} |
|
my $mapresobj; |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (ref($navmap)) { |
|
$mapresobj = $navmap->getResourceByUrl($mapurl); |
|
} |
|
$mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1}; |
|
my $type=$2; |
|
my $path; |
|
if (ref($mapresobj)) { |
|
my $pcslist = $mapresobj->map_hierarchy(); |
|
if ($pcslist ne '') { |
|
foreach my $pc (split(/,/,$pcslist)) { |
|
next if ($pc <= 1); |
|
my $res = $navmap->getByMapPc($pc); |
|
if (ref($res)) { |
|
my $thisurl = $res->src(); |
|
$thisurl=~s{^.*/([^/]+)\.\w+$}{$1}; |
|
my $thistitle = $res->title(); |
|
$path .= '&'. |
|
&Apache::lonhtmlcommon::entity_encode($thisurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($thistitle). |
|
':'.$res->randompick(). |
|
':'.$res->randomout(). |
|
':'.$res->encrypted(). |
|
':'.$res->randomorder(); |
|
} |
|
} |
|
} |
|
$path .= '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($mapresobj->title()). |
|
':'.$mapresobj->randompick(). |
|
':'.$mapresobj->randomout(). |
|
':'.$mapresobj->encrypted(). |
|
':'.$mapresobj->randomorder(); |
|
} else { |
|
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
|
$path = '&default&...::::'. |
|
'&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($maptitle).'::::'; |
|
} |
|
$path = 'default&'. |
|
&Apache::lonhtmlcommon::entity_encode('Main Course Documents'). |
|
$path; |
|
if ($type eq 'sequence') { |
|
$env{'form.folderpath'}=$path; |
|
$env{'form.pagepath'}=''; |
|
} else { |
|
$env{'form.pagepath'}=$path; |
|
$env{'form.folderpath'}=''; |
|
} |
} |
} |
|
|
# Where do we store these for when we come back? |
# Where do we store these for when we come back? |
Line 2928 sub handler {
|
Line 2983 sub handler {
|
{'pagepath' => 'scalar', |
{'pagepath' => 'scalar', |
'folderpath' => 'scalar'}); |
'folderpath' => 'scalar'}); |
|
|
&Apache::lonnet::logthis("Folder: ".$env{'form.folderpath'}); |
|
|
|
|
|
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
my (@folderpath)=split('&',$env{'form.folderpath'}); |
my (@folderpath)=split('&',$env{'form.folderpath'}); |
$env{'form.foldername'}=&unescape(pop(@folderpath)); |
$env{'form.foldername'}=&unescape(pop(@folderpath)); |