[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm lonmsg.pm lonmsgdisplay.pm lonnavmaps.pm /xml lonxml.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Sun, 24 Dec 2006 22:13:22 -0000
This is a MIME encoded message
--raeburn1166998402
Content-Type: text/plain
raeburn Sun Dec 24 17:13:22 2006 EDT
Modified files:
/loncom/interface lonnavmaps.pm lonmsg.pm lonmsgdisplay.pm
lonfeedback.pm
/loncom/xml lonxml.pm
Log:
Include symb in msgid when sending feedback about a resource.
Include an error bit in msgid (1 if message is a "bomb" caused by an error when rendering a problem.
Include symb and resource title in messsage (<symb> and <resource_title> tags) when feedback is about a resource.
Navigate Contents page now checks for unread feedback or errors using symb instead of just resource url.
Navigate Contents page checks for resource context based on symb in msgid instead of in [url] included in message subject. Backwards compatibility with old-style messages retained.
Subject for feedback messages about resources appends message title instead of url inside [].
Title on feedback page now avoids leaking unencrypted file name in cases where no title was assigned to a resource with hidden url.
When displaying feedback messages about a resource in a course, "Refers to" link displayed when viewer has corresponding course role selected includes symb in the link. Link text is now resource title.
"Refers to" link points to unencrypted resource url if feedback message is viewed under role other than original course, only if user has bre privilege for the resource, otherwise "Refers to" link is not displayed.
lonfeedback -- Some replacement of decode_symb() and &clutter() and &dewrapper() with &get_feedurl_and_clean_symb() for replies and edits of discussion posts.
lonfeedback -- More work on in ensuring hidden urls are encrypted or unencrypted as required.
--raeburn1166998402
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20061224171322.txt"
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.394 loncom/interface/lonnavmaps.pm:1.395
--- loncom/interface/lonnavmaps.pm:1.394 Wed Dec 20 18:25:13 2006
+++ loncom/interface/lonnavmaps.pm Sun Dec 24 17:13:19 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.394 2006/12/20 23:25:13 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.395 2006/12/24 22:13:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1914,22 +1914,32 @@
foreach my $msgid (@keys) {
if ((!$emailstatus{$msgid}) || ($emailstatus{$msgid} eq 'new')) {
- my $plain=
- &LONCAPA::unescape(&LONCAPA::unescape($msgid));
- if ($plain=~/ \[([^\]]+)\]\:/) {
- my $url=$1;
- if ($plain=~/\:Error \[/) {
- $error{$url}.=','.$msgid;
- } else {
- $feedback{$url}.=','.$msgid;
- }
- }
+ my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid,
+ $symb,$error) = &Apache::lonmsg::unpackmsgid($msgid);
+ if (defined($symb)) {
+ if (defined($error) && $error == 1) {
+ $error{$symb}.=','.$msgid;
+ } else {
+ $feedback{$symb}.=','.$msgid;
+ }
+ } else {
+ my $plain=
+ &LONCAPA::unescape(&LONCAPA::unescape($msgid));
+ if ($plain=~/ \[([^\]]+)\]\:/) {
+ my $url=$1;
+ if ($plain=~/\:Error \[/) {
+ $error{$url}.=','.$msgid;
+ } else {
+ $feedback{$url}.=','.$msgid;
+ }
+ }
+ }
}
}
- #url's of resources that have feedbacks
+ #symbs of resources that have feedbacks (will be urls pre-2.3)
$self->{FEEDBACK} = \%feedback;
- #or errors
+ #or errors (will be urls pre 2.3)
$self->{ERROR_MSG} = \%error;
$self->{DISCUSSION_TIME} = \%discussiontime;
$self->{EMAIL_STATUS} = \%emailstatus;
@@ -2116,23 +2126,48 @@
sub getFeedback {
my $self = shift;
my $symb = shift;
+ my $source = shift;
$self->generate_email_discuss_status();
if (!defined($self->{FEEDBACK})) { return ""; }
- return $self->{FEEDBACK}->{$symb};
+ my $feedback;
+ if ($self->{FEEDBACK}->{$symb}) {
+ $feedback = $self->{FEEDBACK}->{$symb};
+ if ($self->{FEEDBACK}->{$source}) {
+ $feedback .= ','.$self->{FEEDBACK}->{$source};
+ }
+ } else {
+ if ($self->{FEEDBACK}->{$source}) {
+ $feedback = $self->{FEEDBACK}->{$source};
+ }
+ }
+ return $feedback;
}
# Private method: Get the errors for that resource (by source).
sub getErrors {
my $self = shift;
+ my $symb = shift;
my $src = shift;
$self->generate_email_discuss_status();
if (!defined($self->{ERROR_MSG})) { return ""; }
- return $self->{ERROR_MSG}->{$src};
+
+ my $errors;
+ if ($self->{ERROR_MSG}->{$symb}) {
+ $errors = $self->{ERROR_MSG}->{$symb};
+ if ($self->{ERROR_MSG}->{$src}) {
+ $errors .= ','.$self->{ERROR_MSG}->{$src};
+ }
+ } else {
+ if ($self->{ERROR_MSG}->{$src}) {
+ $errors = $self->{ERROR_MSG}->{$src};
+ }
+ }
+ return $errors;
}
=pod
@@ -3883,15 +3918,17 @@
sub getFeedback {
my $self = shift;
my $source = $self->src();
+ my $symb = $self->symb();
if ($source =~ /^\/res\//) { $source = substr $source, 5; }
- return $self->{NAV_MAP}->getFeedback($source);
+ return $self->{NAV_MAP}->getFeedback($symb,$source);
}
sub getErrors {
my $self = shift;
my $source = $self->src();
+ my $symb = $self->symb();
if ($source =~ /^\/res\//) { $source = substr $source, 5; }
- return $self->{NAV_MAP}->getErrors($source);
+ return $self->{NAV_MAP}->getErrors($symb,$source);
}
=pod
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.190 loncom/interface/lonmsg.pm:1.191
--- loncom/interface/lonmsg.pm:1.190 Tue Dec 12 20:45:15 2006
+++ loncom/interface/lonmsg.pm Sun Dec 24 17:13:19 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.190 2006/12/13 01:45:15 raeburn Exp $
+# $Id: lonmsg.pm,v 1.191 2006/12/24 22:13:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -47,7 +47,7 @@
sub packagemsg {
my ($subject,$message,$citation,$baseurl,$attachmenturl,
- $recuser,$recdomain,$msgid,$type,$crsmsgid)=@_;
+ $recuser,$recdomain,$msgid,$type,$crsmsgid,$symb,$error)=@_;
$message =&HTML::Entities::encode($message,'<>&"');
$citation=&HTML::Entities::encode($citation,'<>&"');
$subject =&HTML::Entities::encode($subject,'<>&"');
@@ -78,7 +78,7 @@
my $msgcount = &get_uniq();
unless(defined($msgid)) {
$msgid = &buildmsgid($now,$subject,$env{'user.name'},$env{'user.domain'},
- $msgcount,$course_context,$$);
+ $msgcount,$course_context,$symb,$error,$$);
}
my $result = '<sendername>'.$env{'user.name'}.'</sendername>'.
'<senderdomain>'.$env{'user.domain'}.'</senderdomain>'.
@@ -134,7 +134,18 @@
if (defined($attachmenturl)) {
$result.= '<attachmenturl>'.$attachmenturl.'</attachmenturl>';
}
- return $msgid,$result;
+ if (defined($symb)) {
+ $result.= '<symb>'.$symb.'</symb>';
+ if (defined($course_context)) {
+ if ($course_context eq $env{'request.course.id'}) {
+ my $resource_title = &Apache::lonnet::gettitle($symb);
+ if (defined($resource_title)) {
+ $result .= '<resource_title>'.$resource_title.'</resource_title>';
+ }
+ }
+ }
+ }
+ return ($msgid,$result);
}
# ================================================== Unpack message into a hash
@@ -178,17 +189,17 @@
# ======================================================= Get info out of msgid
sub buildmsgid {
- my ($now,$subject,$uname,$udom,$msgcount,$course_context,$pid) = @_;
+ my ($now,$subject,$uname,$udom,$msgcount,$course_context,$symb,$error,$pid) = @_;
$subject=&escape($subject);
return(&escape($now.':'.$subject.':'.$uname.':'.
- $udom.':'.$msgcount.':'.$course_context.':'.$pid));
+ $udom.':'.$msgcount.':'.$course_context.':'.$pid.':'.$symb.':'.$error));
}
sub unpackmsgid {
my ($msgid,$folder,$skipstatus,$status_cache)=@_;
$msgid=&unescape($msgid);
my ($sendtime,$shortsubj,$fromname,$fromdomain,$count,$fromcid,
- $processid)=split(/\:/,&unescape($msgid));
+ $processid,$symb,$error) = split(/\:/,&unescape($msgid));
$shortsubj = &unescape($shortsubj);
$shortsubj = &HTML::Entities::decode($shortsubj);
if (!defined($processid)) { $fromcid = ''; }
@@ -203,7 +214,7 @@
if ($status{$msgid}=~/^error\:/) { $status{$msgid}=''; }
unless ($status{$msgid}) { $status{$msgid}='new'; }
}
- return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid},$fromcid);
+ return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid},$fromcid,$symb,$error);
}
@@ -495,7 +506,8 @@
sub user_normal_msg_raw {
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl,
- $toperm,$currid,$newid,$sentmessage,$crsmsgid)=@_;
+ $toperm,$currid,$newid,$sentmessage,$crsmsgid,$symb,$restitle,
+ $error)=@_;
# Check if allowed missing
my ($status,$packed_message);
my $msgid='undefined';
@@ -506,7 +518,7 @@
($msgid,$packed_message)=
&packagemsg($subject,$message,$citation,$baseurl,
$attachmenturl,$user,$domain,$currid,
- undef,$crsmsgid);
+ undef,$crsmsgid,$symb,$error);
# Store in user folder
$status=&Apache::lonnet::critical(
@@ -525,7 +537,7 @@
'/'.$env{'request.course.sec'})))) {
(undef,my $packed_message_no_citation) =
&packagemsg($subject,$message,undef,$baseurl,$attachmenturl,
- $user,$domain,$currid,undef,$crsmsgid);
+ $user,$domain,$currid,undef,$crsmsgid,$symb,$error);
$status .= &store_sent_mail($msgid,$packed_message_no_citation);
}
} else {
@@ -560,15 +572,15 @@
=pod
-=item * B<user_normal_msg($user, $domain, $subject, $message,
- $citation, $baseurl, $attachmenturl)>: Sends a message to the
- $user at $domain, with subject $subject and message $message.
+=item * B<user_normal_msg($user, $domain, $subject, $message, $citation,
+ $baseurl, $attachmenturl, $toperm, $sentmessage, $symb, $restitle, $error)>:
+ Sends a message to the $user at $domain, with subject $subject and message $message.
=cut
sub user_normal_msg {
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl,
- $toperm,$sentmessage)=@_;
+ $toperm,$sentmessage,$symb,$restitle,$error)=@_;
my $status='';
my %userenv = &Apache::lonnet::get('environment',['msgforward'],
$domain,$user);
@@ -579,12 +591,12 @@
$status.=
&user_normal_msg_raw($forwuser,$forwdomain,$subject,$message,
$citation,$baseurl,$attachmenturl,$toperm,
- undef,undef,$sentmessage).' ';
+ undef,undef,$sentmessage,undef,$symb,$restitle,$error).' ';
}
- } else {
+ } else {
$status=&user_normal_msg_raw($user,$domain,$subject,$message,
$citation,$baseurl,$attachmenturl,$toperm,
- undef,undef,$sentmessage);
+ undef,undef,$sentmessage,undef,$symb,$restitle,$error);
}
return $status;
}
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.58 loncom/interface/lonmsgdisplay.pm:1.59
--- loncom/interface/lonmsgdisplay.pm:1.58 Sat Dec 23 13:27:28 2006
+++ loncom/interface/lonmsgdisplay.pm Sun Dec 24 17:13:19 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.58 2006/12/23 18:27:28 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.59 2006/12/24 22:13:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -774,7 +774,6 @@
my ($blocked,$startblock,$endblock,$numblocked,$folder,$msgstatus) = @_;
my $suffix=&Apache::lonmsg::foldersuffix($folder);
my @messages = &Apache::lonnet::getkeys('nohist_email'.$suffix);
-
#unpack the varibles and repack into temp for sorting
my @temp;
my %descriptions;
@@ -789,7 +788,7 @@
foreach my $msgid (@messages) {
my $esc_msgid=&escape($msgid);
- my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid)=
+ my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid,$processid,$symb,$error) =
&Apache::lonmsg::unpackmsgid($esc_msgid,$folder,undef,
\%status_cache);
next if ($msgstatus ne '' && $msgstatus ne $status);
@@ -1950,7 +1949,9 @@
&build_block_table($r,$startblock,$endblock,\%setters);
return;
}
- &statuschange($msgid,'read',$folder);
+ if ($msgstatus eq '') {
+ &statuschange($msgid,'read',$folder);
+ }
my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]);
my %content=&Apache::lonmsg::unpackagemsg($message{$msgid});
@@ -1989,9 +1990,14 @@
'"><b>'.&mt('Next').'</b></a></td>');
}
$r->print('</tr></table>');
+ my $symb;
+ if (defined($content{'symb'})) {
+ $symb = $content{'symb'};
+ } elsif (defined($content{'baseurl'})) {
+ $symb=&Apache::lonnet::symbread($content{'baseurl'});
+ }
if ($env{'user.adv'}) {
$r->print('<table border="2" width="100%"><tr bgcolor="#FFAAAA"><td>'.&mt('Currently available actions (will open extra window)').':</td>');
- my $symb=&Apache::lonnet::symbread($content{'baseurl'});
if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {
$r->print('<td><b>'.&Apache::loncommon::track_student_link(&mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check').'</b></td>');
}
@@ -2013,6 +2019,17 @@
' ('.$content{'recuser'}[$i].' at '.$content{'recdomain'}[$i].') ';
}
$tolist = join(', ',@recipients);
+ my ($restitle,$baseurl,$refers_to);
+ if (defined($content{'resource_title'})) {
+ $restitle = $content{'resource_title'};
+ } else {
+ if (defined($content{'baseurl'})) {
+ $restitle = &Apache::lonnet::gettitle($content{'baseurl'});
+ }
+ }
+ if (defined($content{'baseurl'})) {
+ $baseurl = &Apache::lonenc::check_encrypt($content{'baseurl'});
+ }
$r->print('<br /><b>'.&mt('Subject').':</b> '.$content{'subject'}.
($folder ne 'sent'?'<br /><b>'.&mt('From').':</b> '.
&Apache::loncommon::aboutmewrapper(
@@ -2023,13 +2040,46 @@
$tolist).
($content{'courseid'}?'<br /><b>'.&mt($crstype).':</b> '.$courseinfo{'description'}.
($content{'coursesec'}?' ('.&mt('Section').': '.$content{'coursesec'}.')':''):'').
- '<br /><b>'.&mt('Time').':</b> '.$content{'time'}.
- ($content{'baseurl'}?'<br /><b>'.&mt('Refers to').':</b> <a href="'.$content{'baseurl'}.'">'.
- $content{'baseurl'}.' ('.&Apache::lonnet::gettitle($content{'baseurl'}).')</a>':'').
- '<p><pre>'.
+ '<br /><b>'.&mt('Time').':</b> '.$content{'time'});
+ if ($baseurl) {
+ if (defined($content{'courseid'}) && defined($env{'request.course.id'})) {
+ if ($content{'courseid'} eq $env{'request.course.id'}) {
+ my $symblink;
+ if ($symb) {
+ &Apache::lonenc::check_decrypt(\$symb);
+ $symblink = '?symb='.$symb;
+ }
+ &Apache::lonenc::check_decrypt(\$baseurl);
+ $r->print('<br /><b>'.&mt('Refers to').':</b> <a href="'.$baseurl.$symblink.'">'.$restitle.'</a>');
+ $refers_to = 1;
+ }
+ }
+ if (!$refers_to) {
+ if ($baseurl =~ m-^/enc/-) {
+ if (defined($content{'courseid'})) {
+ my $unencurl =
+ &Apache::lonenc::unencrypted($baseurl,
+ $content{'courseid'});
+ if (defined($unencurl)) {
+ if (&Apache::lonnet::allowed('bre',$unencurl)) {
+ $r->print('<br /><b>'.&mt('Refers to').
+ ':</b> <a href="'.$unencurl.'">'.$restitle.'</a>');
+ }
+ }
+ }
+ } else {
+ if (&Apache::lonnet::allowed('bre',$baseurl)) {
+ $r->print('<br /><b>'.&mt('Refers to').
+ ':</b> <a href="'.$baseurl.
+ '">'.$restitle.'</a>');
+ }
+ }
+ }
+ }
+ $r->print('<p><pre>'.
&Apache::lontexconvert::msgtexconverted($content{'message'},1).
'</pre><hr />'.&displayresource(%content).'</p>');
- return;
+ return;
}
# =========================================================== Show the citation
@@ -2042,7 +2092,12 @@
#
if (($env{'request.course.id'} eq $content{'courseid'})
&& (&Apache::lonnet::allowed('vgr',$content{'courseid'}))) {
- my $symb=&Apache::lonnet::symbread($content{'baseurl'});
+ my $symb;
+ if (defined($content{'symb'})) {
+ $symb = $content{'symb'};
+ } else {
+ $symb=&Apache::lonnet::symbread($content{'baseurl'});
+ }
# Could not get a symb, give up
unless ($symb) { return $content{'citation'}; }
# Have a symb, can render
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.236 loncom/interface/lonfeedback.pm:1.237
--- loncom/interface/lonfeedback.pm:1.236 Mon Dec 11 13:50:40 2006
+++ loncom/interface/lonfeedback.pm Sun Dec 24 17:13:19 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.236 2006/12/11 18:50:40 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.237 2006/12/24 22:13:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1468,7 +1468,7 @@
}
sub mail_screen {
- my ($r,$feedurl,$options) = @_;
+ my ($r,$feedurl,$options,$symb) = @_;
if (exists($env{'form.origpage'})) {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog','group','ref']);
}
@@ -1479,9 +1479,8 @@
'title' => 'Title',
'reta' => 'Retained attachments',
'atta' => 'Attachment (128 KB max size)',
- );
- my $title=&Apache::lonnet::gettitle($feedurl);
- if (!$title) { $title = $feedurl; }
+ );
+ my $restitle = &get_resource_title($symb,$feedurl);
my $quote='';
my $subject = '';
my $comment = '';
@@ -1669,7 +1668,7 @@
$r->print(<<END);
$start_page
-<h2><tt>$title</tt></h2>
+<h2><tt>$restitle</tt></h2>
<form action="/adm/feedback" method="post" name="mailform"
enctype="multipart/form-data">
$prevtag
@@ -2641,7 +2640,7 @@
}
sub assemble_email {
- my ($feedurl,$message,$prevattempts,$usersaw,$useranswer)=@_;
+ my ($message,$prevattempts,$usersaw,$useranswer)=@_;
my %lt = &Apache::lonlocal::texthash(
'prev' => 'Previous attempts of student (if applicable)',
'orig' => 'Original screen output (if applicable)',
@@ -2719,6 +2718,7 @@
sub decide_receiver {
my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_;
+ &Apache::lonenc::check_decrypt(\$feedurl);
my $typestyle='';
my %to=();
if ($env{'form.discuss'} eq 'author' ||$author) {
@@ -2767,17 +2767,17 @@
}
sub send_msg {
- my ($title,$feedurl,$email,$citations,$attachmenturl,%to)=@_;
+ my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,%to)=@_;
my $status='';
my $sendsomething=0;
+ my $restitle = &get_resource_title($symb,$feedurl);
if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; }
unless ($title=~/\w/) { $title=&mt('Feedback'); }
foreach my $key (keys(%to)) {
if ($key) {
- my $declutter=&Apache::lonnet::declutter($feedurl);
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$key),
- $title.' ['.$declutter.']',$email,$citations,$feedurl,
- $attachmenturl)=~/ok/) {
+ $title.' ['.$restitle.']',$email,$citations,$feedurl,
+ $attachmenturl,undef,undef,$symb,$restitle)=~/ok/) {
$status.='<br />'.&mt('Error sending message to').' '.$key.'<br />';
} else {
$sendsomething++;
@@ -3725,12 +3725,8 @@
my $symb;
if ($env{'form.replydisc'}) {
$symb=(split(/\:\:\:/,$env{'form.replydisc'}))[0];
- my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb);
- $feedurl=&Apache::lonnet::clutter($url);
} elsif ($env{'form.editdisc'}) {
$symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0];
- my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb);
- $feedurl=&Apache::lonnet::clutter($url);
} elsif ($env{'form.origpage'}) {
$symb="";
} else {
@@ -3738,18 +3734,18 @@
}
unless ($symb) {
$symb=$env{'form.symb'};
- if ($symb) {
- my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb);
- $feedurl=&Apache::lonnet::clutter($url);
- }
}
- &Apache::lonenc::check_decrypt(\$symb);
+ if (defined($symb)) {
+ ($symb,$feedurl)=&get_feedurl_and_clean_symb($symb);
+ } else {
+ # backward compatibility (bulletin boards used to be 'wrapped')
+ &Apache::lonenc::check_decrypt(\$feedurl);
+ &dewrapper(\$feedurl);
+ }
my $goahead=1;
if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form|task)$/) {
unless ($symb) { $goahead=0; }
}
- # backward compatibility (bulletin boards used to be 'wrapped')
- &dewrapper(\$feedurl);
if (!$goahead) {
# Ambiguous Problem Resource
$r->internal_redirect('/adm/ambiguous');
@@ -3787,7 +3783,7 @@
}
my $options=&screen_header($feedurl,$symb);
if ($options) {
- &mail_screen($r,$feedurl,$options);
+ &mail_screen($r,$feedurl,$options,$symb);
} else {
&fail_redirect($r,$feedurl);
}
@@ -3800,13 +3796,16 @@
$env{'request.course.id'});
# Get output from resource
+ &Apache::lonenc::check_encrypt(\$feedurl);
my $usersaw=&resource_output($feedurl);
# Get resource answer (need to allow student to view grades for this to work)
&Apache::lonnet::appenv(('allowed.vgr'=>'F'));
- my $useranswer=&Apache::loncommon::get_student_answers(
- $symb,$env{'user.name'},$env{'user.domain'},
- $env{'request.course.id'});
+ my $usersymmb = &Apache::lonenc::check_encrypt($symb);
+ my $useranswer=
+ &Apache::loncommon::get_student_answers(
+ $usersymb),$env{'user.name'},$env{'user.domain'},
+ $env{'request.course.id'});
&Apache::lonnet::delenv('allowed.vgr');
# Get attachments, if any, and not too large
my $attachmenturl='';
@@ -3836,7 +3835,7 @@
my $message=&clear_out_html($env{'form.comment'});
# Assemble email
- my ($email,$citations)=&assemble_email($feedurl,$message,$prevattempts,
+ my ($email,$citations)=&assemble_email($message,$prevattempts,
$usersaw,$useranswer);
# Who gets this?
@@ -3846,7 +3845,7 @@
my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'},
undef,1),
$feedurl,$email,$citations,
- $attachmenturl,%to);
+ $attachmenturl,$symb,%to);
# Discussion? Store that.
my $numpost=0;
@@ -3989,5 +3988,32 @@
return $extra_args;
}
+sub get_resource_title {
+ my ($symb,$feedurl) = @_;
+ my ($restitle,$plainurl);
+ if (defined($symb)) {
+ my $plain_symb = &Apache::lonenc::check_decrypt($symb);
+ $restitle = &Apache::lonnet::gettitle($plain_symb);
+ }
+ if (defined($feedurl)) {
+ $plainurl = &Apache::lonenc::check_decrypt($feedurl);
+ }
+ if (!defined($restitle)) {
+ if (defined($feedurl)) {
+ $restitle = &Apache::lonnet::gettitle($plainurl);
+ }
+ }
+ if ($plainurl ne $feedurl) {
+ my ($plain_filename) = ($plainurl =~ m-/([^/]+)$-);
+ if ($plain_filename eq $restitle) {
+ $restitle = &mt('Untitled resource');
+ }
+ }
+ if ($restitle eq '') {
+ $restitle = &mt('Untitled resource');
+ }
+ return $restitle;
+}
+
1;
__END__
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.433 loncom/xml/lonxml.pm:1.434
--- loncom/xml/lonxml.pm:1.433 Wed Dec 20 17:51:27 2006
+++ loncom/xml/lonxml.pm Sun Dec 24 17:13:20 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.433 2006/12/20 22:51:27 albertel Exp $
+# $Id: lonxml.pm,v 1.434 2006/12/24 22:13:20 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1582,8 +1582,11 @@
$cdom,$cnum);
my $now=time;
if ($now-$lastnotified{$key}>86400) {
+ my $title = &Apache::lonnet::gettitle($symb);
+ my $sentmessage;
&Apache::lonmsg::user_normal_msg($user,$domain,
- "Error [$declutter]",$msg);
+ "Error [$title]",$msg,'','','','',
+ \$sentmessage,$symb,$title,1);
&Apache::lonnet::put('nohist_xmlerrornotifications',
{$key => $now},
$cdom,$cnum);
--raeburn1166998402--