--- loncom/interface/londocs.pm 2013/01/04 00:17:48 1.484.2.20
+++ loncom/interface/londocs.pm 2012/12/05 13:50:32 1.521
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.484.2.20 2013/01/04 00:17:48 raeburn Exp $
+# $Id: londocs.pm,v 1.521 2012/12/05 13:50:32 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -651,7 +651,7 @@ sub print_paste_buffer {
$is_external = 1;
}
- my ($canpaste,$nopaste,$othercrs,$areachange);
+ my ($canpaste,$nopaste,$othercrs,$areachange,$is_uploaded_map);
if ($folder =~ /^supplemental/) {
$canpaste = &supp_pasteable($env{'docs.markedcopy_url'});
unless ($canpaste) {
@@ -1543,7 +1543,7 @@ sub apply_fixups {
if ($folder !~ /^supplemental/) {
$report = 1;
}
- (my $outtext,$errtext) =
+ my ($outtext,$errtext) =
&LONCAPA::map::storemap("/uploaded/$cdom/$cnum/$storefn",1,$report);
if ($errtext) {
return &mt('Paste failed: an error occurred saving the folder or page.');
@@ -2443,7 +2443,7 @@ $form_common.'
$forceedit,
undef,$symb,
&escape($env{'form.folderpath'}),
- $renametitle,'','',1);
+ $renametitle);
if ($jscall) {
$editlink = ''.&mt('Edit').' '."\n";
@@ -3068,6 +3068,7 @@ sub startContentScreen {
if (($mode eq 'navmaps') || ($mode eq 'supplemental')) {
$output .= '
'.&mt('Content Overview').' '."\n";
$output .= ' '.&mt('Content Search').' '."\n";
+ $output .= ' '.&mt('Content Index').' '."\n";
$output .= ''.&mt('Supplemental Content').'';
} else {
$output .= ' '.&mt('Content Editor').' '."\n";
@@ -3213,8 +3214,69 @@ sub handler {
if ($env{'form.command'} eq 'direct') {
my ($mapurl,$id,$resurl);
if ($env{'form.symb'} ne '') {
- $env{'form.folderpath'}=
- &Apache::loncommon::symb_to_docspath($env{'form.symb'});
+ ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'});
+ if ($resurl=~/\.(sequence|page)$/) {
+ $mapurl=$resurl;
+ } 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().
+ ':'.$res->is_page();
+ }
+ }
+ }
+ $path =~ s/^\&//;
+ my $maptitle = $mapresobj->title();
+ if ($mapurl eq 'default') {
+ $maptitle = 'Main Course Documents';
+ }
+ $path .= (($path ne '')? '&' : '').
+ &Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
+ &Apache::lonhtmlcommon::entity_encode($maptitle).
+ ':'.$mapresobj->randompick().
+ ':'.$mapresobj->randomout().
+ ':'.$mapresobj->encrypted().
+ ':'.$mapresobj->randomorder().
+ ':'.$mapresobj->is_page();
+ } else {
+ my $maptitle = &Apache::lonnet::gettitle($mapurl);
+ my $ispage = (($type eq 'page')? 1 : '');
+ if ($mapurl eq 'default') {
+ $maptitle = 'Main Course Documents';
+ }
+ $path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
+ &Apache::lonhtmlcommon::entity_encode($maptitle).':::::'.$ispage;
+ }
+ unless ($mapurl eq 'default') {
+ $path = 'default&'.
+ &Apache::lonhtmlcommon::entity_encode('Main Course Documents').
+ ':::::&'.$path;
+ }
+ $env{'form.folderpath'}=$path;
} elsif ($env{'form.supppath'} ne '') {
$env{'form.folderpath'}=$env{'form.supppath'};
}
@@ -3237,9 +3299,6 @@ sub handler {
if ((!$env{'form.folderpath'}) && $allowed) {
&Apache::loncommon::restore_course_settings($stored_folderpath,
{'folderpath' => 'scalar'});
- unless (&unescape($env{'form.folderpath'}) =~ m{^(default|supplemental)&}) {
- undef($env{'form.folderpath'});
- }
}
# If we are not allowed to make changes, all we can see are supplemental docs
@@ -4219,7 +4278,7 @@ sub generate_edit_table {
my $form;
my $activetab;
my $active;
- if (($env{'form.active'} ne '') && ($env{'form.active'} ne 'aa')) {
+ if($env{'form.active'} ne ''){
$activetab = $env{'form.active'};
}
my $backicon = $iconpath.'clickhere.gif';