version 1.227, 2006/12/06 11:50:51
|
version 1.238, 2006/12/27 02:45:41
|
Line 74 sub discussion_visible {
|
Line 74 sub discussion_visible {
|
|
|
sub list_discussion { |
sub list_discussion { |
my ($mode,$status,$ressymb,$imsextras,$group)=@_; |
my ($mode,$status,$ressymb,$imsextras,$group)=@_; |
|
unless ($ressymb) { $ressymb=&Apache::lonnet::symbread(); } |
|
unless ($ressymb) { return ''; } |
|
$ressymb=&wrap_symb($ressymb); |
my $outputtarget=$env{'form.grade_target'}; |
my $outputtarget=$env{'form.grade_target'}; |
if (defined($env{'form.export'})) { |
if (defined($env{'form.export'})) { |
if($env{'form.export'}) { |
if($env{'form.export'}) { |
Line 85 sub list_discussion {
|
Line 88 sub list_discussion {
|
$outputtarget = 'export'; |
$outputtarget = 'export'; |
} |
} |
} |
} |
if (not &discussion_visible($status)) { return ''; } |
if (not &discussion_visible($status)) { |
|
if ($mode ne 'board') { |
|
&Apache::lonenc::check_encrypt(\$ressymb); |
|
return &send_message_link($ressymb); |
|
} |
|
} |
if ($group ne '' && $mode eq 'board') { |
if ($group ne '' && $mode eq 'board') { |
if (&check_group_priv($group,'vgb') ne 'ok') { |
if (&check_group_priv($group,'vgb') ne 'ok') { |
return ''; |
return ''; |
} |
} |
} |
} |
|
|
my ($blocked,$blocktext) = &blocking_posts('boards',1); |
my ($blocked,$blocktext) = |
|
&Apache::loncommon::blocking_status('boards'); |
if ($blocked) { |
if ($blocked) { |
return $blocktext; |
&Apache::lonenc::check_encrypt(\$ressymb); |
|
if ($mode ne 'board') { |
|
$blocktext.='<br />'.&send_message_link($ressymb); |
|
} |
|
return $blocktext; |
} |
} |
|
|
my @bgcols = ("#cccccc","#eeeeee"); |
my @bgcols = ("#cccccc","#eeeeee"); |
Line 107 sub list_discussion {
|
Line 120 sub list_discussion {
|
$crs.='_'.$env{'request.course.sec'}; |
$crs.='_'.$env{'request.course.sec'}; |
} |
} |
$crs=~s/\_/\//g; |
$crs=~s/\_/\//g; |
unless ($ressymb) { $ressymb=&Apache::lonnet::symbread(); } |
|
unless ($ressymb) { return ''; } |
|
$ressymb=&wrap_symb($ressymb); |
|
my $encsymb=&Apache::lonenc::check_encrypt($ressymb); |
my $encsymb=&Apache::lonenc::check_encrypt($ressymb); |
my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs) |
my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs) |
&& ($ressymb=~/\.(problem|exam|quiz|assess|survey|form|task)$/)); |
&& ($ressymb=~/\.(problem|exam|quiz|assess|survey|form|task)$/)); |
Line 722 END
|
Line 732 END
|
} |
} |
} |
} |
} else { |
} else { |
$discussion.='<table bgcolor="#BBBBBB"><tr><td>'; |
$discussion.='<table class="LC_feedback_link"><tr><td>'; |
if (&discussion_open($status) && |
if (&discussion_open($status) && |
&Apache::lonnet::allowed('pch', |
&Apache::lonnet::allowed('pch', |
$env{'request.course.id'}. |
$env{'request.course.id'}. |
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { |
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { |
if ($outputtarget ne 'tex') { |
if ($outputtarget ne 'tex') { |
$discussion.='<a href="/adm/feedback?replydisc='. |
$discussion.= &send_feedback_link($ressymb,$target). |
&escape($ressymb).':::" '.$target.'>'. |
'<br />'; |
'<img alt="" src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" border="0" />'. |
|
&mt('Post Discussion').'</a><br />'; |
|
} |
} |
} |
} |
$discussion.='<a href="/adm/feedback?sendmessageonly=1&symb='. |
if ($outputtarget ne 'tex') { |
&escape($ressymb). |
$discussion.= &send_message_link($ressymb); |
'"><img alt="" src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" border="0" />'. |
} |
&mt('Send Message').'</a></td></tr></table>'; |
$discussion.='</td></tr></table>'; |
} |
} |
return $discussion; |
return $discussion; |
} |
} |
|
|
|
sub send_feedback_link { |
|
my ($ressymb,$target) = @_; |
|
my $output = '<span class="LC_feedback_link">'. |
|
' <a href="/adm/feedback?replydisc='. |
|
&escape($ressymb).':::" '.$target.'>'. |
|
'<img alt="" src="'. |
|
&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif'). |
|
'" border="0" />'.&mt('Post Discussion').'</a></span>'; |
|
return $output; |
|
} |
|
|
|
sub send_message_link { |
|
my ($ressymb) = @_; |
|
my $output = '<span class="LC_feedback_link">'. |
|
' <a href="/adm/feedback?sendmessageonly=1&symb='. |
|
&escape($ressymb).'"><img alt="" src="'. |
|
&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif'). |
|
'" border="0" />'.&mt('Send Message').'</a></span>'; |
|
return $output; |
|
} |
|
|
sub action_links_bar { |
sub action_links_bar { |
my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_; |
my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_; |
my $discussion = '<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'. |
my $discussion = '<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'. |
Line 795 sub action_links_bar {
|
Line 824 sub action_links_bar {
|
return $discussion; |
return $discussion; |
} |
} |
|
|
sub blocking_posts { |
|
my ($type,$showstatus) = @_; |
|
my %setters; |
|
my ($blocked,$output); |
|
my ($startblock,$endblock) = |
|
&Apache::loncommon::blockcheck(\%setters,$type); |
|
if ($startblock && $endblock) { |
|
$blocked = 1; |
|
if ($showstatus) { |
|
my $showstart = &Apache::lonlocal::locallocaltime($startblock); |
|
my $showend = &Apache::lonlocal::locallocaltime($endblock); |
|
$output = &mt('Discussion postings will not be viewable for resources in this course between [_1] and [_2] because communication is being blocked.',$showstart, $showend).'<br />'. |
|
&Apache::loncommon::build_block_table($startblock,$endblock, |
|
\%setters); |
|
} |
|
} |
|
return ($blocked,$output); |
|
} |
|
|
|
sub postingform_display { |
sub postingform_display { |
my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum, |
my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum, |
$currnewattach,$currdelold,$group) = @_; |
$currnewattach,$currdelold,$group) = @_; |
Line 850 ENDDISCUSS
|
Line 860 ENDDISCUSS
|
if ($group ne '') { |
if ($group ne '') { |
$postingform .='<input type="hidden" name="group" value="'.$group.'" />'; |
$postingform .='<input type="hidden" name="group" value="'.$group.'" />'; |
} |
} |
my ($blockblog) = &blocking_posts('blogs'); |
my $blockblog = &Apache::loncommon::blocking_status('blogs'); |
if (!$blockblog) { |
if (!$blockblog) { |
$postingform .= &add_blog_checkbox(); |
$postingform .= &add_blog_checkbox(); |
} |
} |
Line 1458 sub replicate_attachments {
|
Line 1468 sub replicate_attachments {
|
} |
} |
|
|
sub mail_screen { |
sub mail_screen { |
my ($r,$feedurl,$options) = @_; |
my ($r,$feedurl,$options,$symb) = @_; |
if (exists($env{'form.origpage'})) { |
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']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog','group','ref']); |
} |
} |
Line 1469 sub mail_screen {
|
Line 1479 sub mail_screen {
|
'title' => 'Title', |
'title' => 'Title', |
'reta' => 'Retained attachments', |
'reta' => 'Retained attachments', |
'atta' => 'Attachment (128 KB max size)', |
'atta' => 'Attachment (128 KB max size)', |
); |
); |
my $title=&Apache::lonnet::gettitle($feedurl); |
my $restitle = &get_resource_title($symb,$feedurl); |
if (!$title) { $title = $feedurl; } |
|
my $quote=''; |
my $quote=''; |
my $subject = ''; |
my $subject = ''; |
my $comment = ''; |
my $comment = ''; |
Line 1659 END
|
Line 1668 END
|
|
|
$r->print(<<END); |
$r->print(<<END); |
$start_page |
$start_page |
<h2><tt>$title</tt></h2> |
<h2><tt>$restitle</tt></h2> |
<form action="/adm/feedback" method="post" name="mailform" |
<form action="/adm/feedback" method="post" name="mailform" |
enctype="multipart/form-data"> |
enctype="multipart/form-data"> |
$prevtag |
$prevtag |
Line 1728 END
|
Line 1737 END
|
if ($env{'form.editdisc'} || $env{'form.replydisc'}) { |
if ($env{'form.editdisc'} || $env{'form.replydisc'}) { |
my $now = time; |
my $now = time; |
my $ressymb = $symb; |
my $ressymb = $symb; |
|
&Apache::lonenc::check_encrypt(\$ressymb); |
my $postidx = ''; |
my $postidx = ''; |
if ($env{'form.editdisc'}) { |
if ($env{'form.editdisc'}) { |
$postidx = $idx; |
$postidx = $idx; |
Line 1735 END
|
Line 1745 END
|
if (@currnewattach > 0) { |
if (@currnewattach > 0) { |
$attachnum += @currnewattach; |
$attachnum += @currnewattach; |
} |
} |
my ($blockblog) = &blocking_posts('blogs'); |
my $blockblog = &Apache::loncommon::blocking_status('blogs'); |
$r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver,'',$blockblog)); |
$r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver,'',$blockblog)); |
if ($attachnum > 0) { |
if ($attachnum > 0) { |
if (@currnewattach > 0) { |
if (@currnewattach > 0) { |
Line 2471 sub redirect_back {
|
Line 2481 sub redirect_back {
|
$feedurl .= '?group='.$group.$refarg; |
$feedurl .= '?group='.$group.$refarg; |
} |
} |
} |
} |
$feedurl=&Apache::lonenc::check_encrypt($feedurl); |
&Apache::lonenc::check_encrypt(\$feedurl); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my %onload; |
my %onload; |
if ($env{'environment.remote'} ne 'off') { |
if ($env{'environment.remote'} ne 'off') { |
Line 2528 sub no_redirect_back {
|
Line 2538 sub no_redirect_back {
|
|
|
my $end_page = &Apache::loncommon::end_page(); |
my $end_page = &Apache::loncommon::end_page(); |
|
|
$feedurl=&Apache::lonenc::check_encrypt($feedurl); |
&Apache::lonenc::check_encrypt(\$feedurl); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
$r->print (<<ENDNOREDIRTWO); |
$r->print (<<ENDNOREDIRTWO); |
$start_page |
$start_page |
Line 2572 sub screen_header {
|
Line 2582 sub screen_header {
|
&Apache::lonnet::allowed('pch', |
&Apache::lonnet::allowed('pch', |
$env{'request.course.id'}. |
$env{'request.course.id'}. |
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { |
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { |
my ($blocked) = &blocking_posts('boards'); |
$discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '. |
if (!$blocked) { |
&mt('Contribution to course discussion of resource'); |
$discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '. |
|
&mt('Contribution to course discussion of resource'); |
|
$discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '. |
$discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '. |
&mt('Anonymous contribution to course discussion of resource'). |
&mt('Anonymous contribution to course discussion of resource'). |
' <i>('.&mt('name only visible to course faculty').')</i></label> '. |
' <i>('.&mt('name only visible to course faculty').')</i></label> '. |
'<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>'; |
'<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>'; |
} |
|
} |
} |
my ($blockblog) = &blocking_posts('blogs'); |
my $blockblog = &Apache::loncommon::blocking_status('blogs'); |
if (!$blockblog) { |
if (!$blockblog) { |
$discussoptions.= &add_blog_checkbox(); |
$discussoptions.= &add_blog_checkbox(); |
} |
} |
Line 2633 sub clear_out_html {
|
Line 2640 sub clear_out_html {
|
} |
} |
|
|
sub assemble_email { |
sub assemble_email { |
my ($feedurl,$message,$prevattempts,$usersaw,$useranswer)=@_; |
my ($message,$prevattempts,$usersaw,$useranswer)=@_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'prev' => 'Previous attempts of student (if applicable)', |
'prev' => 'Previous attempts of student (if applicable)', |
'orig' => 'Original screen output (if applicable)', |
'orig' => 'Original screen output (if applicable)', |
Line 2659 sub secapply {
|
Line 2666 sub secapply {
|
my $defaultflag=shift; |
my $defaultflag=shift; |
$rec=~s/\s+//g; |
$rec=~s/\s+//g; |
$rec=~s/\@/\:/g; |
$rec=~s/\@/\:/g; |
my ($adr,$sections)=($rec=~/^([^\(]+)\(([^\)]+)\)/); |
my ($adr,$sections_or_groups)=($rec=~/^([^\(]+)\(([^\)]+)\)/); |
if ($sections) { |
if ($sections_or_groups) { |
foreach my $sec (split(/\;/,$sections)) { |
foreach my $item (split(/\;/,$sections_or_groups)) { |
if (($sec eq $env{'request.course.sec'}) || |
if (($item eq $env{'request.course.sec'}) || |
($defaultflag && ($sec eq '*'))) { |
($defaultflag && ($item eq '*'))) { |
return $adr; |
return $adr; |
} |
} elsif ($env{'request.course.groups'}) { |
|
my @usersgroups = split(/:/,$env{'request.course.groups'}); |
|
if (grep(/^\Q$item\E$/,@usersgroups)) { |
|
return $adr; |
|
} |
|
} |
} |
} |
} else { |
} else { |
return $rec; |
return $rec; |
Line 2706 Returns
|
Line 2718 Returns
|
|
|
sub decide_receiver { |
sub decide_receiver { |
my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_; |
my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_; |
|
&Apache::lonenc::check_decrypt(\$feedurl); |
my $typestyle=''; |
my $typestyle=''; |
my %to=(); |
my %to=(); |
if ($env{'form.discuss'} eq 'author' ||$author) { |
if ($env{'form.discuss'} eq 'author' ||$author) { |
$typestyle.='Submitting as Author Feedback<br />'; |
$typestyle.='Submitting as Author Feedback<br />'; |
$feedurl=~ s/^\/res\/($LONAPA::domain_re)/($LONCAPA::username_re)/; |
$feedurl=~ m{^/res/($LONCAPA::domain_re)/($LONCAPA::username_re)/}; |
$to{$2.':'.$1}=1; |
$to{$2.':'.$1}=1; |
} |
} |
if ($env{'form.discuss'} eq 'question' ||$question) { |
if ($env{'form.discuss'} eq 'question' ||$question) { |
Line 2754 sub feedback_available {
|
Line 2767 sub feedback_available {
|
} |
} |
|
|
sub send_msg { |
sub send_msg { |
my ($title,$feedurl,$email,$citations,$attachmenturl,%to)=@_; |
my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,%to)=@_; |
my $status=''; |
my $status=''; |
my $sendsomething=0; |
my $sendsomething=0; |
|
my $restitle = &get_resource_title($symb,$feedurl); |
if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; } |
if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; } |
unless ($title=~/\w/) { $title=&mt('Feedback'); } |
unless ($title=~/\w/) { $title=&mt('Feedback'); } |
foreach my $key (keys(%to)) { |
foreach my $key (keys(%to)) { |
if ($key) { |
if ($key) { |
my $declutter=&Apache::lonnet::declutter($feedurl); |
|
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$key), |
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$key), |
$title.' ['.$declutter.']',$email,$citations,$feedurl, |
$title.' ['.$restitle.']',$email,$citations,$feedurl, |
$attachmenturl)=~/ok/) { |
$attachmenturl,undef,undef,$symb,$restitle)=~/ok/) { |
$status.='<br />'.&mt('Error sending message to').' '.$key.'<br />'; |
$status.='<br />'.&mt('Error sending message to').' '.$key.'<br />'; |
} else { |
} else { |
$sendsomething++; |
$sendsomething++; |
Line 2816 sub adddiscuss {
|
Line 2829 sub adddiscuss {
|
$contrib{'anonymous'}='true'; |
$contrib{'anonymous'}='true'; |
} |
} |
if (($symb) && ($email)) { |
if (($symb) && ($email)) { |
|
my $now = time; |
if ($env{'form.editdisc'}) { |
if ($env{'form.editdisc'}) { |
$contrib{'ip'}=$ENV{'REMOTE_ADDR'}; |
$contrib{'ip'}=$ENV{'REMOTE_ADDR'}; |
$contrib{'host'}=$Apache::lonnet::perlvar{'lonHostID'}; |
$contrib{'host'}=$Apache::lonnet::perlvar{'lonHostID'}; |
$contrib{'timestamp'} = time; |
$contrib{'timestamp'} = $now; |
$contrib{'history'} = ''; |
$contrib{'history'} = ''; |
my $numoldver = 0; |
my $numoldver = 0; |
my ($oldsymb,$oldidx)=split(/\:\:\:/,$env{'form.editdisc'}); |
my ($oldsymb,$oldidx)=split(/\:\:\:/,$env{'form.editdisc'}); |
Line 2870 sub adddiscuss {
|
Line 2884 sub adddiscuss {
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
} |
} |
my %storenewentry=($symb => time); |
my %storenewentry=($symb => $now); |
$status.='<br />'.&mt('Updating discussion time').': '. |
$status.='<br />'.&mt('Updating discussion time').': '. |
&Apache::lonnet::put('discussiontimes',\%storenewentry, |
&Apache::lonnet::put('discussiontimes',\%storenewentry, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
Line 2891 sub adddiscuss {
|
Line 2905 sub adddiscuss {
|
return $status.'<br />'; |
return $status.'<br />'; |
} |
} |
|
|
|
sub get_discussion_info { |
|
my ($idx,%contrib) = @_; |
|
my $changelast = 0; |
|
my $count = 0; |
|
my $hiddenflag = 0; |
|
my $deletedflag = 0; |
|
my ($hidden,$deleted,%info,$newlastdisc); |
|
my $version = $contrib{'version'}; |
|
if ($version) { |
|
for (my $id=$version; $id>0; $id--) { |
|
my $vkeys=$contrib{$id.':keys'}; |
|
my @keys=split(/:/,$vkeys); |
|
if (grep(/^hidden$/,@keys)) { |
|
if (!$hiddenflag) { |
|
$hidden = $contrib{$id.':hidden'}; |
|
$hiddenflag = 1; |
|
} |
|
} elsif (grep(/^deleted$/,@keys)) { |
|
if (!$deletedflag) { |
|
$deleted = $contrib{$id.':deleted'}; |
|
$deletedflag = 1; |
|
} |
|
} else { |
|
if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./)) { |
|
$count++; |
|
$info{$count}{'id'} = $id; |
|
$info{$count}{'timestamp'}=$contrib{$id.':timestamp'}; |
|
} |
|
} |
|
} |
|
if ($info{'1'}{'id'} == $idx) { |
|
$changelast = 1; |
|
if ($count > 1) { |
|
$newlastdisc = $info{'2'}{'timestamp'}; |
|
} else { |
|
$newlastdisc = 0; |
|
} |
|
} |
|
} |
|
return ($changelast,$newlastdisc); |
|
} |
|
|
# ----------------------------------------------------------- Preview function |
# ----------------------------------------------------------- Preview function |
|
|
sub show_preview { |
sub show_preview { |
Line 3559 ENDREDIR
|
Line 3615 ENDREDIR
|
if ( ($env{'form.hide'}) && (!$seeid) ) { |
if ( ($env{'form.hide'}) && (!$seeid) ) { |
$newhash{'studenthidden'} = $currentstudenthidden; |
$newhash{'studenthidden'} = $currentstudenthidden; |
} |
} |
|
if ($env{'form.hide'}) { |
|
my $changelast = 0; |
|
my $newlast; |
|
($changelast,$newlast) = &get_discussion_info($idx,%contrib); |
|
if ($changelast) { |
|
&Apache::lonnet::put('discussiontimes',{$symb => $newlast}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
} |
|
} |
&Apache::lonnet::store(\%newhash,$symb,$env{'request.course.id'}, |
&Apache::lonnet::store(\%newhash,$symb,$env{'request.course.id'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
Line 3588 ENDREDIR
|
Line 3653 ENDREDIR
|
my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'}, |
my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
my ($changelast,$newlast) = &get_discussion_info($idx,%contrib); |
|
if ($changelast) { |
|
&Apache::lonnet::put('discussiontimes',{$symb => $newlast}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); |
|
} |
my %newhash=('deleted' => $contrib{'deleted'}.".$idx."); |
my %newhash=('deleted' => $contrib{'deleted'}.".$idx."); |
&Apache::lonnet::store(\%newhash,$symb,$env{'request.course.id'}, |
&Apache::lonnet::store(\%newhash,$symb,$env{'request.course.id'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
Line 3655 ENDREDIR
|
Line 3725 ENDREDIR
|
my $symb; |
my $symb; |
if ($env{'form.replydisc'}) { |
if ($env{'form.replydisc'}) { |
$symb=(split(/\:\:\:/,$env{'form.replydisc'}))[0]; |
$symb=(split(/\:\:\:/,$env{'form.replydisc'}))[0]; |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); |
|
$feedurl=&Apache::lonnet::clutter($url); |
|
} elsif ($env{'form.editdisc'}) { |
} elsif ($env{'form.editdisc'}) { |
$symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0]; |
$symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0]; |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); |
|
$feedurl=&Apache::lonnet::clutter($url); |
|
} elsif ($env{'form.origpage'}) { |
} elsif ($env{'form.origpage'}) { |
$symb=""; |
$symb=""; |
} else { |
} else { |
Line 3668 ENDREDIR
|
Line 3734 ENDREDIR
|
} |
} |
unless ($symb) { |
unless ($symb) { |
$symb=$env{'form.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; |
my $goahead=1; |
if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form|task)$/) { |
if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form|task)$/) { |
unless ($symb) { $goahead=0; } |
unless ($symb) { $goahead=0; } |
} |
} |
# backward compatibility (bulletin boards used to be 'wrapped') |
|
&dewrapper(\$feedurl); |
|
if (!$goahead) { |
if (!$goahead) { |
# Ambiguous Problem Resource |
# Ambiguous Problem Resource |
$r->internal_redirect('/adm/ambiguous'); |
$r->internal_redirect('/adm/ambiguous'); |
Line 3698 ENDREDIR
|
Line 3764 ENDREDIR
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
# Unable to give feedback |
# Unable to give feedback |
|
&Apache::lonenc::check_encrypt(\$feedurl); |
&no_redirect_back($r,$feedurl); |
&no_redirect_back($r,$feedurl); |
return OK; |
return OK; |
} |
} |
# --------------------------------------------------- Print login screen header |
# --------------------------------------------------- Print login screen header |
unless ($env{'form.sendit'}) { |
unless ($env{'form.sendit'}) { |
|
&Apache::lonenc::check_encrypt(\$feedurl); |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
if (($env{'form.replydisc'}) || ($env{'form.editdisc'})) { |
|
my ($blocked,$blocktext) = |
|
&Apache::loncommon::blocking_status('boards'); |
|
if ($blocked) { |
|
$r->print(&blocked_reply_or_edit($blocktext)); |
|
return OK; |
|
} |
|
} |
my $options=&screen_header($feedurl,$symb); |
my $options=&screen_header($feedurl,$symb); |
if ($options) { |
if ($options) { |
&mail_screen($r,$feedurl,$options); |
&mail_screen($r,$feedurl,$options,$symb); |
} else { |
} else { |
&fail_redirect($r,$feedurl); |
&fail_redirect($r,$feedurl); |
} |
} |
Line 3720 ENDREDIR
|
Line 3796 ENDREDIR
|
$env{'request.course.id'}); |
$env{'request.course.id'}); |
|
|
# Get output from resource |
# Get output from resource |
|
&Apache::lonenc::check_encrypt(\$feedurl); |
my $usersaw=&resource_output($feedurl); |
my $usersaw=&resource_output($feedurl); |
|
|
# Get resource answer (need to allow student to view grades for this to work) |
# Get resource answer (need to allow student to view grades for this to work) |
&Apache::lonnet::appenv(('allowed.vgr'=>'F')); |
&Apache::lonnet::appenv(('allowed.vgr'=>'F')); |
my $useranswer=&Apache::loncommon::get_student_answers( |
my $usersymb = &Apache::lonenc::check_encrypt($symb); |
$symb,$env{'user.name'},$env{'user.domain'}, |
my $useranswer= |
$env{'request.course.id'}); |
&Apache::loncommon::get_student_answers( |
|
$usersymb,$env{'user.name'},$env{'user.domain'}, |
|
$env{'request.course.id'}); |
&Apache::lonnet::delenv('allowed.vgr'); |
&Apache::lonnet::delenv('allowed.vgr'); |
# Get attachments, if any, and not too large |
# Get attachments, if any, and not too large |
my $attachmenturl=''; |
my $attachmenturl=''; |
Line 3756 ENDREDIR
|
Line 3835 ENDREDIR
|
my $message=&clear_out_html($env{'form.comment'}); |
my $message=&clear_out_html($env{'form.comment'}); |
|
|
# Assemble email |
# Assemble email |
my ($email,$citations)=&assemble_email($feedurl,$message,$prevattempts, |
my ($email,$citations)=&assemble_email($message,$prevattempts, |
$usersaw,$useranswer); |
$usersaw,$useranswer); |
|
|
# Who gets this? |
# Who gets this? |
Line 3766 ENDREDIR
|
Line 3845 ENDREDIR
|
my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}, |
my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}, |
undef,1), |
undef,1), |
$feedurl,$email,$citations, |
$feedurl,$email,$citations, |
$attachmenturl,%to); |
$attachmenturl,$symb,%to); |
|
|
# Discussion? Store that. |
# Discussion? Store that. |
my $numpost=0; |
my $numpost=0; |
Line 3796 ENDREDIR
|
Line 3875 ENDREDIR
|
&redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},undef,undef,undef,undef,undef,undef,$group); |
&redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},undef,undef,undef,undef,undef,undef,$group); |
} |
} |
return OK; |
return OK; |
|
} |
|
|
|
sub blocked_reply_or_edit { |
|
my ($blocktext) = @_; |
|
return |
|
&Apache::loncommon::start_page('Resource Feedback and Discussion'). |
|
$blocktext.'<br /><br /><a href="javascript:history.go(-1)">'. |
|
&mt('Back to previous page'). |
|
&Apache::loncommon::end_page(); |
} |
} |
|
|
sub wrap_symb { |
sub wrap_symb { |
Line 3900 sub group_args {
|
Line 3988 sub group_args {
|
return $extra_args; |
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; |
1; |
__END__ |
__END__ |