'.
'';
if ($visible>2) {
@@ -482,7 +480,6 @@ imscp_v1p1.xsd http://www.imsglobal.org/
my $postfilename = $alldiscussion{$_}.'-'.$imsitems{$alldiscussion{$_}}{'timestamp'}.'.html';
if ($manifestok) {
if (($depth[$alldiscussion{$_}] <= $currdepth) && ($alldiscussion{$_} != $firstidx)) {
- print STDERR "depth is $depth[$alldiscussion{$_}], currdepth is $currdepth, idx is $alldiscussion{$_}, firstidx is $firstidx\n";
print $manifestfile ' '."\n";
}
$currdepth = $depth[$alldiscussion{$_}];
@@ -608,7 +605,7 @@ END
undef(%oldENV);
$discussion .= 'Download the zip file from Discussion Posting Archive ';
if ($copyresult) {
- $discussion .= 'The following errors occurred during export - '.$copyresult;
+ $discussion .= 'The following errors occurred during export - '.$copyresult;
}
} else {
$discussion .= ' Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating a manifest file. ';
@@ -682,7 +679,7 @@ ENDDISCUSS
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) {
if ($outputtarget ne 'tex') {
$discussion.='';
}
@@ -1056,12 +1053,14 @@ sub get_post_contents {
return $discussion;
}
}
- $$screenname=&Apache::loncommon::screenname(
- $$contrib{$idx.':sendername'},
- $$contrib{$idx.':senderdomain'});
- $$plainname=&Apache::loncommon::nickname(
- $$contrib{$idx.':sendername'},
- $$contrib{$idx.':senderdomain'});
+# $$screenname=&Apache::loncommon::screenname(
+# $$contrib{$idx.':sendername'},
+# $$contrib{$idx.':senderdomain'});
+# $$plainname=&Apache::loncommon::nickname(
+# $$contrib{$idx.':sendername'},
+# $$contrib{$idx.':senderdomain'});
+ ($$screenname,$$plainname)=($$contrib{$idx.':screenname'},
+ $$contrib{$idx.':plainname'});
my $sender=&Apache::loncommon::aboutmewrapper(
$$plainname,
$$contrib{$idx.':sendername'},
@@ -1159,22 +1158,23 @@ sub replicate_attachments {
$i ++;
}
my ($content,$rtncode);
- print STDERR "File to replicate is $$attachrefs{$id}{'filename'} in $1,$2\n";
my $uploadreply = &Apache::lonnet::getuploaded('GET',$$attachrefs{$id}{'filename'},$1,$2,$content,$rtncode);
if ($uploadreply eq 'ok') {
- my $attachcopy;
- if ($attachcopy = Apache::File->new('>'.$destination)) {
- print $attachcopy $content;
- close($attachcopy);
- } else {
- $response .= 'Error copying a file attachment to IMS package: '.$!.' '."\n";
- }
+ my $attachcopy;
+ if ($attachcopy = Apache::File->new('>'.$destination)) {
+ print $attachcopy $content;
+ close($attachcopy);
+ } else {
+ $response .= 'Error copying file attachment - '.$5.' to IMS package: '.$!.' '."\n";
+ }
} else {
- print STDERR "return code from lonnet was $rtncode\n";
+ &Apache::lonnet::logthis("Replication of attachment failed when building IMS export of discussion posts - domain: $1, course: $2, file: $$attachrefs{$id}{'filename'} -error: $rtncode");
+ $response .= 'Error copying file attachment - '.$5.' to IMS package: '.$rtncode.' '."\n";
}
}
}
}
+ return $response;
}
sub mail_screen {
@@ -2050,6 +2050,7 @@ sub redirect_back {
$sectag = '';
}
}
+ $feedurl=&Apache::lonenc::check_encrypt($feedurl);
$r->print (<
@@ -2087,9 +2088,10 @@ sub no_redirect_back {
ENDNOREDIR
if ($feedurl!~/^\/adm\/feedback/) {
- $r->print('');
+ $r->print('');
}
-
+ $feedurl=&Apache::lonenc::check_encrypt($feedurl);
$r->print (<
@@ -2718,6 +2720,24 @@ sub construct_attachmenturl {
}
return $newattachmenturl;
}
+
+sub has_discussion {
+ my $resourcesref = shift;
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ my @allres=$navmap->retrieveResources();
+ foreach my $resource (@allres) {
+ if ($resource->hasDiscussion()) {
+ my $ressymb;
+ if ($resource->symb() =~ m-(___adm/\w+/\w+)/(\d+)/bulletinboard$-) {
+ $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard';
+ } else {
+ $ressymb = $resource->symb();
+ }
+ push @{$resourcesref}, $ressymb;
+ }
+ }
+ return;
+}
sub handler {
my $r = shift;
@@ -2730,7 +2750,7 @@ sub handler {
# --------------------------- Get query string for limited number of parameters
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','threadedon','threadedoff','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navmaps','navurl','sortfilter','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export']);
+ ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','threadedon','threadedoff','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortfilter','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export']);
if ($ENV{'form.discsymb'}) {
my $symb = $ENV{'form.discsymb'};
my $readkey = $symb.'_read';
@@ -2877,13 +2897,17 @@ END
}
&print_sortfilter_options($r,$symb,$previous,$feedurl);
return OK;
- } elsif ($ENV{'form.navmaps'}) {
+ } elsif ($ENV{'form.navtime'}) {
my %discinfo = ();
my @resources = ();
- if ($ENV{'form.navmaps'} =~ /:/) {
- @resources = split/:/,$ENV{'form.navmaps'};
+ if (defined($ENV{'form.navmaps'})) {
+ if ($ENV{'form.navmaps'} =~ /:/) {
+ @resources = split/:/,$ENV{'form.navmaps'};
+ } else {
+ @resources = ("$ENV{'form.navmaps'}");
+ }
} else {
- @resources = ("$ENV{'form.navmaps'}");
+ &has_discussion(\@resources);
}
my $numitems = @resources;
my $feedurl = '/adm/navmaps';
@@ -2892,7 +2916,8 @@ END
}
my %lt = &Apache::lonlocal::texthash(
'mnpa' => 'Marked "New" posts as read in a total of',
- 'robb' => 'resources/bulletin boards.'
+ 'robb' => 'resources/bulletin boards.',
+ 'twnp' => 'There are currently no resources or bulletin boards with unread discussion postings.'
);
foreach (@resources) {
# backward compatibility (bulletin boards used to be 'wrapped')
@@ -2903,9 +2928,14 @@ END
}
}
my $lastkey = $ressymb.'_lastread';
- $discinfo{$lastkey} = time;
+ $discinfo{$lastkey} = $ENV{'form.navtime'};
+ }
+ my $textline = "$lt{'mnpa'} $numitems $lt{'robb'}";
+ if ($numitems > 0) {
+ &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
+ } else {
+ $textline = "$lt{'twnp'}";
}
- &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
$r->print (<
-$lt{'mnpa'} $numitems $lt{'robb'}
+$textline
Continue
|