version 1.179, 2006/02/09 20:30:47
|
version 1.203, 2006/05/10 22:47:22
|
Line 726 ENDDISCUSS
|
Line 726 ENDDISCUSS
|
if ($outputtarget ne 'tex') { |
if ($outputtarget ne 'tex') { |
$discussion.=&generate_attachments_button('',$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,'',$mode); |
$discussion.=&generate_attachments_button('',$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,'',$mode); |
if (@currnewattach > 0) { |
if (@currnewattach > 0) { |
$newattachmsg .= '<b>New attachments</b><br />'; |
$newattachmsg .= '<br /><b>New attachments</b><br />'; |
if (@currnewattach > 1) { |
if (@currnewattach > 1) { |
$newattachmsg .= '<ol>'; |
$newattachmsg .= '<ol>'; |
foreach my $item (@currnewattach) { |
foreach my $item (@currnewattach) { |
Line 744 ENDDISCUSS
|
Line 744 ENDDISCUSS
|
} |
} |
} |
} |
} else { |
} else { |
|
$discussion.='<table bgcolor="#BBBBBB"><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.='<table bgcolor="#BBBBBB"><tr><td><a href="/adm/feedback?replydisc='. |
$discussion.='<a href="/adm/feedback?replydisc='. |
&Apache::lonnet::escape($ressymb).':::" '.$target.'>'. |
&Apache::lonnet::escape($ressymb).':::" '.$target.'>'. |
'<img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" border="0" />'. |
'<img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" border="0" />'. |
&mt('Post Discussion').'</a></td></tr></table>'; |
&mt('Post Discussion').'</a><br />'; |
} |
} |
} |
} |
|
$discussion.='<a href="/adm/feedback?sendmessageonly=1&symb='. |
|
&Apache::lonnet::escape($ressymb). |
|
'"><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" border="0" />'. |
|
&mt('Send Message').'</td></tr></table>'; |
} |
} |
return $discussion; |
return $discussion; |
} |
} |
Line 906 sub build_posting_display {
|
Line 911 sub build_posting_display {
|
} else { |
} else { |
@{$$namesort{$lastname}{$firstname}} = ("$idx"); |
@{$$namesort{$lastname}{$firstname}} = ("$idx"); |
} |
} |
if ($env{'course.'.$env{'request.course.id'}.'.allow_discussion_post_editing'} =~ m/yes/i) { |
if (&editing_allowed()) { |
if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) { |
if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) { |
$sender.=' <a href="/adm/feedback?editdisc='. |
$sender.=' <a href="/adm/feedback?editdisc='. |
$escsymb.':::'.$idx; |
$escsymb.':::'.$idx; |
Line 1253 END
|
Line 1258 END
|
} |
} |
} |
} |
if ($type eq 'allversions') { |
if ($type eq 'allversions') { |
$discussion.=('</ul></body></html>'); |
$discussion.='</ul>'; |
return $discussion; |
return $discussion; |
} else { |
} else { |
return; |
return; |
Line 1303 sub mail_screen {
|
Line 1308 sub mail_screen {
|
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']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog']); |
} |
} |
my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion', |
|
'','onLoad="window.focus();setposttype();"'); |
|
my $title=&Apache::lonnet::gettitle($feedurl); |
my $title=&Apache::lonnet::gettitle($feedurl); |
if (!$title) { $title = $feedurl; } |
if (!$title) { $title = $feedurl; } |
my $quote=''; |
my $quote=''; |
Line 1324 sub mail_screen {
|
Line 1328 sub mail_screen {
|
my $attachnum = 0; |
my $attachnum = 0; |
my $anonchk = (<<END); |
my $anonchk = (<<END); |
function anonchk() { |
function anonchk() { |
if (document.mailform.anondiscuss.checked == true) { |
for (var i=0; i < document.mailform.discuss.length; i++) { |
document.attachment.anondiscuss.value = '1' |
if (document.mailform.discuss[i].checked) { |
} |
document.attachment.discuss.value = |
if (document.mailform.discuss.checked == true) { |
document.mailform.discuss[i].value; |
document.attachment.discuss.value = '1' |
} |
} |
} |
|
if (document.mailform.blog.checked) { |
|
document.attachment.blog.value = 1; |
|
} |
return |
return |
} |
} |
END |
END |
Line 1337 END
|
Line 1344 END
|
if (exists($env{'form.origpage'})) { |
if (exists($env{'form.origpage'})) { |
$anonscript = (<<END); |
$anonscript = (<<END); |
function setposttype() { |
function setposttype() { |
var anondisc = $env{'form.anondiscuss'}; |
var disc = "$env{'form.discuss'}"; |
var disc = $env{'form.discuss'}; |
for (var i=0; i < document.mailform.discuss.length; i++) { |
if (anondisc == 1) { |
if (disc == document.mailform.discuss[i].value) { |
document.mailform.anondiscuss.checked = true |
document.mailform.discuss[i].checked = 1; |
|
} |
} |
} |
if (disc == 1) { |
var blog = "$env{'form.blog'}"; |
document.mailform.discuss.checked = true |
if (blog == 1) { |
|
document.mailform.blog.checked=1; |
} |
} |
return |
return |
} |
} |
Line 1410 END
|
Line 1419 END
|
$parentmsg = $contrib{$idx.':replyto'}; |
$parentmsg = $contrib{$idx.':replyto'}; |
} |
} |
unless (exists($env{'form.origpage'})) { |
unless (exists($env{'form.origpage'})) { |
my $anonflag = 0; |
my $anonflag = 'nonanon'; |
if ($contrib{$idx.':anonymous'}) { |
if ($contrib{$idx.':anonymous'}) { |
$anonflag = 1; |
$anonflag = 'anon'; |
} |
} |
$anonscript = (<<END); |
$anonscript = (<<END); |
function setposttype () { |
function setposttype () { |
var currtype = $anonflag |
var currtype = "$anonflag"; |
if (currtype == 1) { |
for (var i=0; i<document.mailform.discuss.length; i++) { |
document.mailform.elements.discuss.checked = false |
if (document.mailform.elements.discuss[i].value == currtype ) { |
document.mailform.elements.anondiscuss.checked = true |
document.mailform.elements.discuss[i].checked=1; |
} |
} |
if (currtype == 0) { |
|
document.mailform.elements.anondiscuss.checked = false |
|
document.mailform.elements.discuss.checked = true |
|
} |
} |
return |
return |
} |
} |
Line 1442 END
|
Line 1448 END
|
&process_attachments(\@currnewattach,\@currdelold,\@keepold); |
&process_attachments(\@currnewattach,\@currdelold,\@keepold); |
} |
} |
my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(); |
my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(); |
my $htmlheader=&Apache::lonhtmlcommon::htmlareaheaders(); |
|
my $send=&mt('Send'); |
my $send=&mt('Send'); |
my $html=&Apache::lonxml::xmlbegin(); |
my $js= <<END; |
$r->print(<<END); |
|
$html |
|
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
<meta http-equiv="pragma" content="no-cache"></meta> |
|
$htmlheader |
|
<script type="text/javascript"> |
<script type="text/javascript"> |
//<!-- |
//<!-- |
function gosubmit() { |
function gosubmit() { |
var rec=0; |
var rec=0; |
if (typeof(document.mailform.elements.author)!="undefined") { |
|
if (document.mailform.elements.author.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (typeof(document.mailform.elements.question)!="undefined") { |
|
if (document.mailform.elements.question.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (typeof(document.mailform.elements.course)!="undefined") { |
|
if (document.mailform.elements.course.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (typeof(document.mailform.elements.policy)!="undefined") { |
|
if (document.mailform.elements.policy.checked) { |
|
rec=1; |
|
} |
|
} |
|
if (typeof(document.mailform.elements.discuss)!="undefined") { |
if (typeof(document.mailform.elements.discuss)!="undefined") { |
if (document.mailform.elements.discuss.checked) { |
if (typeof(document.mailform.elements.discuss.length) == "undefined") { |
rec=1; |
if (document.mailform.elements.discuss.checked ) { |
} |
rec=1; |
} |
} |
if (typeof(document.mailform.elements.anondiscuss)!="undefined") { |
} else { |
if (document.mailform.elements.anondiscuss.checked) { |
for (var i=0; i<document.mailform.elements.discuss.length; i++) { |
rec=1; |
if (document.mailform.elements.discuss[i].checked ) { |
} |
rec=1; |
} |
} |
|
} |
|
} |
|
} |
if (typeof(document.mailform.elements.blog)!="undefined") { |
if (typeof(document.mailform.elements.blog)!="undefined") { |
if (document.mailform.elements.blog.checked) { |
if (document.mailform.elements.blog.checked) { |
rec=1; |
rec=1; |
Line 1497 $htmlheader
|
Line 1479 $htmlheader
|
} |
} |
document.mailform.submit(); |
document.mailform.submit(); |
} else { |
} else { |
alert('Please check a feedback type.'); |
alert('Please select a feedback type.'); |
} |
} |
} |
} |
$anonchk |
$anonchk |
$anonscript |
$anonscript |
//--> |
//--> |
</script> |
</script> |
</head> |
END |
$bodytag |
|
|
my %onload = ('onload' => 'window.focus();setposttype();'); |
|
my $start_page= |
|
&Apache::loncommon::start_page('Resource Feedback and Discussion',$js, |
|
{'add_entries' => \%onload}); |
|
|
|
$r->print(<<END); |
|
$start_page |
<h2><tt>$title</tt></h2> |
<h2><tt>$title</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"> |
Line 1579 END
|
Line 1568 END
|
$r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver)); |
$r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver)); |
if ($attachnum > 0) { |
if ($attachnum > 0) { |
if (@currnewattach > 0) { |
if (@currnewattach > 0) { |
$newattachmsg .= '<b>New attachments</b><br />'; |
$newattachmsg .= '<br /><b>New attachments</b><br />'; |
if (@currnewattach > 1) { |
if (@currnewattach > 1) { |
$newattachmsg .= '<ol>'; |
$newattachmsg .= '<ol>'; |
foreach my $item (@currnewattach) { |
foreach my $item (@currnewattach) { |
Line 1602 END
|
Line 1591 END
|
} |
} |
$r->print(&generate_preview_button(). |
$r->print(&generate_preview_button(). |
&Apache::lonhtmlcommon::htmlareaselectactive('comment'). |
&Apache::lonhtmlcommon::htmlareaselectactive('comment'). |
'</body></html>'); |
&Apache::loncommon::end_page()); |
|
|
} |
} |
|
|
sub print_display_options { |
sub print_display_options { |
Line 1613 sub print_display_options {
|
Line 1603 sub print_display_options {
|
my $function = &Apache::loncommon::get_users_function(); |
my $function = &Apache::loncommon::get_users_function(); |
my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', |
my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', |
$env{'user.domain'}); |
$env{'user.domain'}); |
my $bodytag=&Apache::loncommon::bodytag('Discussion options', |
|
'',''); |
|
|
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'dido' => 'Discussion display options', |
|
'pref' => 'Display Preference', |
'pref' => 'Display Preference', |
'curr' => 'Current setting ', |
'curr' => 'Current setting ', |
'actn' => 'Action', |
'actn' => 'Action', |
Line 1675 sub print_display_options {
|
Line 1662 sub print_display_options {
|
$currtogg = $lt{'toggon'}; |
$currtogg = $lt{'toggon'}; |
$disctogg = 'toggon'; |
$disctogg = 'toggon'; |
} |
} |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<END); |
my $js = <<END; |
$html |
<script type="text/javascript"> |
<head> |
|
<title>$lt{'dido'}</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
<script> |
|
function discdispChk(caller) { |
function discdispChk(caller) { |
var disctogg = '$toggchg' |
var disctogg = '$toggchg' |
if (caller == 0) { |
if (caller == 0) { |
Line 1748 function setDisp() {
|
Line 1731 function setDisp() {
|
} |
} |
} |
} |
</script> |
</script> |
</head> |
END |
$bodytag |
|
<form name="modifydisp" method="post" action="/adm/feedback"> |
|
|
my $start_page = |
|
&Apache::loncommon::start_page('Discussion display options',$js); |
|
my $end_page = |
|
&Apache::loncommon::end_page(); |
|
$r->print(<<END); |
|
$start_page |
|
<form name="modifydisp" method="POST" action="/adm/feedback"> |
$lt{'sdpf'}<br/> $lt{'prca'} <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li><li>$lt{'wipa'}</li></ol> |
$lt{'sdpf'}<br/> $lt{'prca'} <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li><li>$lt{'wipa'}</li></ol> |
<br /> |
<br /> |
<table border="0" cellpadding="0" cellspacing="0"> |
END |
<tr> |
$r->print(&Apache::loncommon::start_data_table()); |
<td width="100%" bgcolor="#000000"> |
$r->print(<<END); |
<table width="100%" border="0" cellpadding="1" cellspacing="0"> |
<tr> |
<tr> |
<th>$lt{'pref'}</td> |
<td width="100%" bgcolor="#000000"> |
<th>$lt{'curr'}</td> |
<table border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> |
<th>$lt{'actn'}?</td> |
<tr bgcolor="$tabcolor"> |
|
<td><b>$lt{'pref'}</b></td> |
|
<td><b>$lt{'curr'}</b></td> |
|
<td><b>$lt{'actn'}?</b></td> |
|
</tr> |
</tr> |
<tr bgcolor="#dddddd"> |
END |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$r->print(<<END); |
<td>$lt{'disa'}</td> |
<td>$lt{'disa'}</td> |
<td>$lt{$discdisp}</td> |
<td>$lt{$discdisp}</td> |
<td><label><input type="checkbox" name="discdisp" onClick="discdispChk('0')" /> $lt{'chgt'} "$dispchangeA"</label> |
<td><label><input type="checkbox" name="discdisp" onClick="discdispChk('0')" /> $lt{'chgt'} "$dispchangeA"</label> |
<br /> |
<br /> |
<label><input type="checkbox" name="discdisp" onClick="discdispChk('1')" /> $lt{'chgt'} "$dispchangeB"</label> |
<label><input type="checkbox" name="discdisp" onClick="discdispChk('1')" /> $lt{'chgt'} "$dispchangeB"</label> |
</td> |
</td> |
</tr><tr bgcolor="#eeeeee"> |
END |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$r->print(<<END); |
<td>$lt{'npmr'}</td> |
<td>$lt{'npmr'}</td> |
<td>$lt{$discmark}</td> |
<td>$lt{$discmark}</td> |
<td><label><input type="checkbox" name="discmark" />$lt{'chgt'} "$markchange"</label></td> |
<td><label><input type="checkbox" name="discmark" />$lt{'chgt'} "$markchange"</label></td> |
</tr><tr bgcolor="#dddddd"> |
END |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$r->print(<<END); |
<td>$lt{'dotm'}</td> |
<td>$lt{'dotm'}</td> |
<td>$lt{$disctogg}</td> |
<td>$lt{$disctogg}</td> |
<td><label><input type="checkbox" name="disctogg" onClick="discdispChk('2')" />$lt{'chgt'} "$toggchange"</label></td> |
<td><label><input type="checkbox" name="disctogg" onClick="discdispChk('2')" />$lt{'chgt'} "$toggchange"</label></td> |
</tr> |
END |
</table> |
$r->print(&Apache::loncommon::end_data_table_row()); |
</td> |
$r->print(&Apache::loncommon::end_data_table()); |
</tr> |
$r->print(<<END); |
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
<br /> |
<br /> |
<br /> |
<br /> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="symb" value="$symb" /> |
Line 1800 $lt{'sdpf'}<br/> $lt{'prca'} <ol><li>$l
|
Line 1790 $lt{'sdpf'}<br/> $lt{'prca'} <ol><li>$l
|
<br /> |
<br /> |
<br /> |
<br /> |
</form> |
</form> |
</body> |
$end_page |
</html> |
|
END |
END |
return; |
return; |
} |
} |
Line 1813 sub print_sortfilter_options {
|
Line 1802 sub print_sortfilter_options {
|
$r->send_http_header; |
$r->send_http_header; |
|
|
&Apache::lonenc::check_encrypt(\$symb); |
&Apache::lonenc::check_encrypt(\$symb); |
my @sections = (); |
my @sections; |
my $section_sel = ''; |
my $section_sel = ''; |
my $numsections = 0; |
|
my $numvisible = 5; |
my $numvisible = 5; |
my %sectioncount = (); |
my %sectioncount = &Apache::loncommon::get_sections(); |
|
|
$numsections = &Apache::loncommon::get_sections($env{'course.'.$env{'request.course.id'}.'.domain'},$env{'course.'.$env{'request.course.id'}.'.num'},\%sectioncount); |
|
|
|
if ($env{'request.course.sec'} !~ /^\s*$/) { #Restrict section choice to current section |
if ($env{'request.course.sec'} !~ /^\s*$/) { #Restrict section choice to current section |
@sections = ('all',$env{'request.course.sec'}); |
@sections = ('all',$env{'request.course.sec'}); |
$numvisible = 2; |
$numvisible = 2; |
} else { |
} else { |
@sections = sort {$a cmp $b} keys(%sectioncount); |
@sections = sort {$a cmp $b} keys(%sectioncount); |
unshift(@sections,'all'); # Put 'all' at the front of the list |
if (scalar(@sections) < 4) { |
if ($numsections < 4) { |
$numvisible = scalar(@sections) + 1; |
$numvisible = $numsections + 1; |
|
} |
} |
|
unshift(@sections,'all'); # Put 'all' at the front of the list |
|
|
} |
} |
foreach (@sections) { |
foreach (@sections) { |
$section_sel .= " <option value=\"$_\" />$_\n"; |
$section_sel .= " <option value=\"$_\" />$_\n"; |
Line 1838 sub print_sortfilter_options {
|
Line 1825 sub print_sortfilter_options {
|
my $function = &Apache::loncommon::get_users_function(); |
my $function = &Apache::loncommon::get_users_function(); |
my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', |
my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', |
$env{'user.domain'}); |
$env{'user.domain'}); |
my $bodytag=&Apache::loncommon::bodytag('Discussion options', |
|
'',''); |
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'diso' => 'Discussion sorting and filtering options', |
|
'diop' => 'Display Options', |
'diop' => 'Display Options', |
'curr' => 'Current setting ', |
'curr' => 'Current setting ', |
'actn' => 'Action', |
'actn' => 'Action', |
Line 1858 sub print_sortfilter_options {
|
Line 1842 sub print_sortfilter_options {
|
my %role_types = (); |
my %role_types = (); |
my %status_types = (); |
my %status_types = (); |
&sort_filter_names(\%sort_types,\%role_types,\%status_types); |
&sort_filter_names(\%sort_types,\%role_types,\%status_types); |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<END); |
my $js = <<END; |
$html |
|
<head> |
|
<title>$lt{'diso'}</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
<script type="text/javascript"> |
<script type="text/javascript"> |
function verifyFilter() { |
function verifyFilter() { |
var rolenum = 0 |
var rolenum = 0 |
Line 1888 function verifyFilter() {
|
Line 1868 function verifyFilter() {
|
document.modifyshown.submit(); |
document.modifyshown.submit(); |
} |
} |
</script> |
</script> |
</head> |
END |
$bodytag |
|
<form name="modifyshown" method="post" action="/adm/feedback"> |
my $start_page= |
|
&Apache::loncommon::start_page('Discussion options',$js); |
|
my $end_page= |
|
&Apache::loncommon::end_page(); |
|
|
|
$r->print(<<END); |
|
$start_page |
|
<form name="modifyshown" method="POST" action="/adm/feedback"> |
<b>$lt{'diso'}</b><br/> $lt{'prca'} |
<b>$lt{'diso'}</b><br/> $lt{'prca'} |
<br /><br /> |
<br /><br /> |
<table border="0"> |
<table border="0"> |
Line 1955 $bodytag
|
Line 1942 $bodytag
|
<br /> |
<br /> |
<br /> |
<br /> |
</form> |
</form> |
</body> |
$end_page |
</html> |
|
END |
END |
} |
} |
|
|
Line 1978 sub print_showposters {
|
Line 1964 sub print_showposters {
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
my %namesort = (); |
my %namesort = (); |
my %postcounts = (); |
my %postcounts = (); |
my %lt=&Apache::lonlocal::texthash( |
|
'diso' => 'Discussion filtering options', |
|
); |
|
my $bodytag=&Apache::loncommon::bodytag('Discussion options', |
|
'',''); |
|
if ($contrib{'version'}) { |
if ($contrib{'version'}) { |
for (my $idx=1;$idx<=$contrib{'version'};$idx++) { |
for (my $idx=1;$idx<=$contrib{'version'};$idx++) { |
my $hidden=($contrib{'hidden'}=~/\.$idx\./); |
my $hidden=($contrib{'hidden'}=~/\.$idx\./); |
Line 2014 sub print_showposters {
|
Line 1996 sub print_showposters {
|
} |
} |
} |
} |
} |
} |
my $html=&Apache::lonxml::xmlbegin(); |
|
|
my $start_page = &Apache::loncommon::start_page('Discussion options'); |
|
my $table_start =&Apache::loncommon::start_data_table(); |
$r->print(<<END); |
$r->print(<<END); |
$html |
$start_page |
<head> |
|
<title>$lt{'diso'}</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
</head> |
|
$bodytag |
|
<form name="pickpostersform" method="post"> |
<form name="pickpostersform" method="post"> |
<table border="0"> |
<br /> |
<tr> |
$table_start |
<td bgcolor="#777777"> |
<tr> |
<table border="0" cellpadding="3"> |
<th>No.</th> |
<tr bgcolor="#e6ffff"> |
<th>Select</th> |
<td><b>No.</b></td> |
<th>Fullname<font color="#999999">(Username/domain)</font></th> |
<td><b>Select</b></td> |
<th>Posts</th> |
<td><b>Fullname</b><font color="#999999">(Username/domain)</font></td> |
|
<td><b>Posts</td> |
|
</tr> |
</tr> |
END |
END |
my $count = 0; |
my $count = 0; |
Line 2043 END
|
Line 2020 END
|
next; |
next; |
} else { |
} else { |
$count ++; |
$count ++; |
$r->print('<tr bgcolor="#ffffe6"><td align="right">'.$count.'</td><td align="center"><label><input name="stuinfo" type="checkbox" value="'.$_.'" /></td><td>'.$last.', '.$first.' ('.$uname.','.$udom.')</label></td><td>'.$postcounts{$_}.'</td></tr>'); |
$r->print(&Apache::loncommon::start_data_table_row(). |
|
'<td align="right">'.$count.'</td> |
|
<td align="center"><label><input name="stuinfo" type="checkbox" value="'.$_.'" /></td> |
|
<td>'.$last.', '.$first.' ('.$uname.','.$udom.')</label></td> |
|
<td>'.$postcounts{$_}.'</td>'. |
|
&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
} |
} |
} |
} |
|
$r->print(&Apache::loncommon::end_data_table()); |
|
my $end_page = &Apache::loncommon::end_page(); |
$r->print(<<END); |
$r->print(<<END); |
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
<br /> |
<br /> |
<input type="hidden" name="sortposts" value="$sortposts" /> |
<input type="hidden" name="sortposts" value="$sortposts" /> |
<input type="hidden" name="userpick" value="$symb" /> |
<input type="hidden" name="userpick" value="$symb" /> |
<input type="button" name="store" value="Display posts" onClick="javascript:document.pickpostersform.submit()" /> |
<input type="button" name="store" value="Display posts" onClick="javascript:document.pickpostersform.submit()" /> |
</form> |
</form> |
</body> |
$end_page |
</html> |
|
END |
END |
} |
} |
|
|
Line 2067 sub get_post_versions {
|
Line 2046 sub get_post_versions {
|
my ($versions,$incoming,$htmldecode,$numver) = @_; |
my ($versions,$incoming,$htmldecode,$numver) = @_; |
if ($incoming =~ /^<version num="0">/) { |
if ($incoming =~ /^<version num="0">/) { |
my $p = HTML::LCParser->new(\$incoming); |
my $p = HTML::LCParser->new(\$incoming); |
my $done = 0; |
my $done = 0; |
|
|
while ( (my $token = $p->get_tag("version")) && (!$done)) { |
while ( (my $token = $p->get_tag("version")) && (!$done)) { |
my $num = $token->[1]{num}; |
my $num = $token->[1]{num}; |
my $text = $p->get_text("/version"); |
my $text = $p->get_text("/version"); |
Line 2128 sub fail_redirect {
|
Line 2108 sub fail_redirect {
|
my ($r,$feedurl) = @_; |
my ($r,$feedurl) = @_; |
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; |
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $html=&Apache::lonxml::xmlbegin(); |
$r->print(&Apache::loncommon::start_page('Feedback not sent',undef, |
$r->print (<<ENDFAILREDIR); |
{'redirect' => [2,$feedurl], |
$html |
'only_body' => 1,})); |
<head> |
$r->print(<<ENDFAILREDIR); |
<title>Feedback not sent</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
|
</head> |
|
<body bgcolor="#FFFFFF"> |
|
<img align="right" src="$logo" /> |
<img align="right" src="$logo" /> |
<b>Sorry, no recipients ...</b> |
<b>Sorry, no recipients ...</b> |
<br /><a href="$feedurl">Continue</a> |
|
</body> |
|
</html> |
|
ENDFAILREDIR |
ENDFAILREDIR |
|
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
sub redirect_back { |
sub redirect_back { |
Line 2216 sub redirect_back {
|
Line 2189 sub redirect_back {
|
} |
} |
$feedurl=&Apache::lonenc::check_encrypt($feedurl); |
$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 $html=&Apache::lonxml::xmlbegin(); |
my %onload; |
$r->print (<<ENDREDIR); |
if ($env{'environment.remote'} ne 'off') { |
$html |
$onload{'onload'} = |
<head> |
"if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }"; |
<title>Feedback sent</title> |
} |
<meta http-equiv="pragma" content="no-cache" /> |
my $start_page= |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
&Apache::loncommon::start_page('New posts marked as read',undef, |
</head> |
{'redirect' => [2,$feedurl], |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'> |
'only_body' => 1, |
|
'add_entries' => \%onload}); |
|
my $end_page = &Apache::loncommon::end_page(); |
|
|
|
$r->print(<<ENDREDIR); |
|
$start_page |
<img align="right" src="$logo" /> |
<img align="right" src="$logo" /> |
$typestyle |
$typestyle |
<b>Sent $sendsomething message(s), and $sendposts post(s).</b> |
<b>Sent $sendsomething message(s), and $sendposts post(s).</b> |
Line 2238 $roletag
|
Line 2216 $roletag
|
$sectag |
$sectag |
$userpicktag |
$userpicktag |
</form> |
</form> |
<br /><a href="$feedurl">Continue</a> |
$end_page |
</body> |
|
</html> |
|
ENDREDIR |
ENDREDIR |
} |
} |
|
|
sub no_redirect_back { |
sub no_redirect_back { |
my ($r,$feedurl) = @_; |
my ($r,$feedurl) = @_; |
my $nofeed=&mt('Sorry, no feedback possible on this resource ...'); |
my $nofeed=&mt('Sorry, no feedback possible on this resource ...'); |
my $continue=&mt('Continue'); |
|
my $html=&Apache::lonxml::xmlbegin(); |
my %onload; |
$r->print (<<ENDNOREDIR); |
if ($env{'environment.remote'} ne 'off') { |
$html |
$onload{'onload'} = |
<head> |
"if (window.name!='loncapaclient') { self.window.close(); }"; |
<title>Feedback not sent</title> |
} |
<meta http-equiv="pragma" content="no-cache" /> |
|
ENDNOREDIR |
my %body_options = ('only_body' => 1, |
|
'bgcolor' => '#FFFFFF', |
if ($feedurl!~/^\/adm\/feedback/) { |
'add_entries' => \%onload,); |
$r->print('<meta HTTP-EQUIV="Refresh" CONTENT="2; url='. |
|
&Apache::lonenc::check_encrypt($feedurl).'">'); |
if ($feedurl !~ m{^/adm/feedback}) { |
} |
$body_options{'rediect'} = [2,$feedurl]; |
|
} |
|
my $start_page= |
|
&Apache::loncommon::start_page('Feedback not sent',undef, |
|
\%body_options); |
|
|
|
my $end_page = &Apache::loncommon::end_page(); |
|
|
$feedurl=&Apache::lonenc::check_encrypt($feedurl); |
$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); |
</head> |
$start_page |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.close(); }'> |
|
<img align="right" src="$logo" /> |
<img align="right" src="$logo" /> |
<b>$nofeed</b> |
<b>$nofeed</b> |
<br /><a href="$feedurl">$continue</a> |
<br /> |
</body> |
$end_page |
</html> |
|
ENDNOREDIRTWO |
ENDNOREDIRTWO |
} |
} |
|
|
Line 2280 sub screen_header {
|
Line 2261 sub screen_header {
|
unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) { |
unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) { |
if (($feedurl=~/^\/res\//) && ($feedurl!~/^\/res\/adm/) && ($env{'user.adv'})) { |
if (($feedurl=~/^\/res\//) && ($feedurl!~/^\/res\/adm/) && ($env{'user.adv'})) { |
$msgoptions= |
$msgoptions= |
'<p><label><input type="checkbox" name="author" /> '. |
'<p><label><input type="radio" name="discuss" value="author" /> '. |
&mt('Feedback to resource author').'</label></p>'; |
&mt('Feedback to resource author').'</label></p>'; |
} |
} |
if (&feedback_available(1)) { |
if (&feedback_available(1)) { |
$msgoptions.= |
$msgoptions.= |
'<p><label><input type="checkbox" name="question" /> '. |
'<p><label><input type="radio" name="discuss" value="question" /> '. |
&mt('Question about resource content').'</label></p>'; |
&mt('Question about resource content').'</label></p>'; |
} |
} |
if (&feedback_available(0,1)) { |
if (&feedback_available(0,1)) { |
$msgoptions.= |
$msgoptions.= |
'<p><label><input type="checkbox" name="course" /> '. |
'<p><label><input type="radio" name="discuss" value="course" /> '. |
&mt('Question/Comment/Feedback about course content'). |
&mt('Question/Comment/Feedback about course content'). |
'</label></p>'; |
'</label></p>'; |
} |
} |
if (&feedback_available(0,0,1)) { |
if (&feedback_available(0,0,1)) { |
$msgoptions.= |
$msgoptions.= |
'<p><label><input type="checkbox" name="policy" /> '. |
'<p><label><input type="radio" name="discuss" value="policy" /> '. |
&mt('Question/Comment/Feedback about course policy'). |
&mt('Question/Comment/Feedback about course policy'). |
'</label></p>'; |
'</label></p>'; |
} |
} |
} |
} |
if ($env{'request.course.id'}) { |
if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) { |
if (&discussion_open(undef,$symb) && |
if (&discussion_open(undef,$symb) && |
&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'}:''))) { |
$discussoptions='<label><input type="checkbox" name="discuss" onClick="this.form.anondiscuss.checked=false;" '. |
$discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '. |
($env{'form.replydisc'}?' checked="1"':'').' /> '. |
|
&mt('Contribution to course discussion of resource'); |
&mt('Contribution to course discussion of resource'); |
$discussoptions.='</label><br /><label><input type="checkbox" name="anondiscuss" onClick="this.form.discuss.checked=false;" /> '. |
$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>'; |
} |
} |
#$discussoptions.='<br /><label><input type="checkbox" name="blog" /> '. |
$discussoptions.='<br /><label><input type="checkbox" name="blog" /> '. |
# &mt('Add to my public course blog').'</label>'; |
&mt('Add to my public course blog').'</label>'; |
} |
} |
if ($msgoptions) { $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" />'.&mt('Sending Messages').'</h2>'.$msgoptions; } |
if ($msgoptions) { $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" />'.&mt('Sending Messages').'</h2>'.$msgoptions; } |
if ($discussoptions) { |
if ($discussoptions) { |
Line 2337 sub resource_output {
|
Line 2317 sub resource_output {
|
} |
} |
|
|
sub clear_out_html { |
sub clear_out_html { |
my ($message,$override)=@_; |
my ($message,$override,$ignore_htmlarea)=@_; |
unless (&Apache::lonhtmlcommon::htmlareablocked()) { return $message; } |
if (!$ignore_htmlarea |
|
&& !&Apache::lonhtmlcommon::htmlareablocked()) { return $message; } |
# Always allow the <m>-tag |
# Always allow the <m>-tag |
my %html=(M=>1); |
my %html=(M=>1); |
# Check if more is allowed |
# Check if more is allowed |
Line 2354 sub clear_out_html {
|
Line 2335 sub clear_out_html {
|
H1=>1, H2=>1, H3=>1, H4=>1, H5=>1); |
H1=>1, H2=>1, H3=>1, H4=>1, H5=>1); |
} |
} |
# Do the substitution of everything that is not explicitly allowed |
# Do the substitution of everything that is not explicitly allowed |
$message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/ |
$message =~ s/\<(\/?\s*(\w*)[^\>\<]*)/ |
{($html{uc($2)}&&(length($1)<1000))?"\<$1":"\<$1"}/ge; |
{($html{uc($2)}&&(length($1)<1000))?"\<$1":"\<$1"}/ge; |
$message =~ s/(\<?\s*(\w+)[^\<\>]*)\>/ |
$message =~ s/(\<?\s*(\w*)[^\<\>]*)\>/ |
{($html{uc($2)}&&(length($1)<1000))?"$1\>":"$1\>"}/ge; |
{($html{uc($2)}&&(length($1)<1000))?"$1\>":"$1\>"}/ge; |
return $message; |
return $message; |
} |
} |
Line 2432 sub decide_receiver {
|
Line 2413 sub decide_receiver {
|
my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_; |
my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_; |
my $typestyle=''; |
my $typestyle=''; |
my %to=(); |
my %to=(); |
if ($env{'form.author'}||$author) { |
if ($env{'form.discuss'} eq 'author' ||$author) { |
$typestyle.='Submitting as Author Feedback<br />'; |
$typestyle.='Submitting as Author Feedback<br />'; |
$feedurl=~/^\/res\/(\w+)\/(\w+)\//; |
$feedurl=~/^\/res\/(\w+)\/(\w+)\//; |
$to{$2.':'.$1}=1; |
$to{$2.':'.$1}=1; |
} |
} |
if ($env{'form.question'}||$question) { |
if ($env{'form.discuss'} eq 'question' ||$question) { |
$typestyle.='Submitting as Question<br />'; |
$typestyle.=&mt('Submitting as Question').'<br />'; |
foreach (split(/\,/, |
foreach (split(/\,/, |
$env{'course.'.$env{'request.course.id'}.'.question.email'}) |
$env{'course.'.$env{'request.course.id'}.'.question.email'}) |
) { |
) { |
Line 2446 sub decide_receiver {
|
Line 2427 sub decide_receiver {
|
if ($rec) { $to{$rec}=1; } |
if ($rec) { $to{$rec}=1; } |
} |
} |
} |
} |
if ($env{'form.course'}||$course) { |
if ($env{'form.discuss'} eq 'course' ||$course) { |
$typestyle.='Submitting as Comment<br />'; |
$typestyle.=&mt('Submitting as Comment').'<br />'; |
foreach (split(/\,/, |
foreach (split(/\,/, |
$env{'course.'.$env{'request.course.id'}.'.comment.email'}) |
$env{'course.'.$env{'request.course.id'}.'.comment.email'}) |
) { |
) { |
Line 2455 sub decide_receiver {
|
Line 2436 sub decide_receiver {
|
if ($rec) { $to{$rec}=1; } |
if ($rec) { $to{$rec}=1; } |
} |
} |
} |
} |
if ($env{'form.policy'}||$policy) { |
if ($env{'form.discuss'} eq 'policy' ||$policy) { |
$typestyle.='Submitting as Policy Feedback<br />'; |
$typestyle.=&mt('Submitting as Policy Feedback').'<br />'; |
foreach (split(/\,/, |
foreach (split(/\,/, |
$env{'course.'.$env{'request.course.id'}.'.policy.email'}) |
$env{'course.'.$env{'request.course.id'}.'.policy.email'}) |
) { |
) { |
Line 2478 sub feedback_available {
|
Line 2459 sub feedback_available {
|
} |
} |
|
|
sub send_msg { |
sub send_msg { |
my ($feedurl,$email,$citations,$attachmenturl,%to)=@_; |
my ($title,$feedurl,$email,$citations,$attachmenturl,%to)=@_; |
my $status=''; |
my $status=''; |
my $sendsomething=0; |
my $sendsomething=0; |
|
if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; } |
|
unless ($title=~/\w/) { $title=&mt('Feedback'); } |
foreach (keys %to) { |
foreach (keys %to) { |
if ($_) { |
if ($_) { |
my $declutter=&Apache::lonnet::declutter($feedurl); |
my $declutter=&Apache::lonnet::declutter($feedurl); |
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$_), |
unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$_), |
'Feedback ['.$declutter.']',$email,$citations,$feedurl, |
$title.' ['.$declutter.']',$email,$citations,$feedurl, |
$attachmenturl)=~/ok/) { |
$attachmenturl)=~/ok/) { |
$status.='<br />'.&mt('Error sending message to').' '.$_.'<br />'; |
$status.='<br />'.&mt('Error sending message to').' '.$_.'<br />'; |
} else { |
} else { |
Line 2539 sub adddiscuss {
|
Line 2522 sub adddiscuss {
|
} |
} |
if (($symb) && ($email)) { |
if (($symb) && ($email)) { |
if ($env{'form.editdisc'}) { |
if ($env{'form.editdisc'}) { |
my %newcontrib = (); |
|
$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'} = time; |
Line 2582 sub adddiscuss {
|
Line 2564 sub adddiscuss {
|
} |
} |
} |
} |
$contrib{'history'} .= $oldcontrib{$oldidx.':timestamp'}; |
$contrib{'history'} .= $oldcontrib{$oldidx.':timestamp'}; |
foreach (keys %contrib) { |
|
my $key = $oldidx.':'.&Apache::lonnet::escape($oldsymb).':'.$_; |
|
$newcontrib{$key} = $contrib{$_}; |
|
} |
|
my $put_reply = &Apache::lonnet::putstore($env{'request.course.id'}, |
my $put_reply = &Apache::lonnet::putstore($env{'request.course.id'}, |
\%newcontrib, |
$oldsymb,$oldidx,\%contrib, |
$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'}); |
$status='Editing class discussion'.($anon?' (anonymous)':''); |
$status='Editing class discussion'.($anon?' (anonymous)':''); |
Line 2621 sub adddiscuss {
|
Line 2599 sub adddiscuss {
|
# ----------------------------------------------------------- Preview function |
# ----------------------------------------------------------- Preview function |
|
|
sub show_preview { |
sub show_preview { |
my $r=shift; |
my ($r) = @_; |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
my $message=&clear_out_html($env{'form.comment'}); |
my $message=&clear_out_html($env{'form.comment'}); |
&newline_to_br(\$message); |
&newline_to_br(\$message); |
$message=&Apache::lonspeller::markeduptext($message); |
$message=&Apache::lonspeller::markeduptext($message); |
$message=&Apache::lontexconvert::msgtexconverted($message); |
$message=&Apache::lontexconvert::msgtexconverted($message); |
my $subject=&clear_out_html($env{'form.subject'}); |
my $subject=&clear_out_html($env{'form.subject'},undef,1); |
$subject=~s/\n/\<br \/\>/g; |
$subject=~s/\n/\<br \/\>/g; |
$subject=&Apache::lontexconvert::msgtexconverted($subject); |
$subject=&Apache::lontexconvert::msgtexconverted($subject); |
my $html=&Apache::lonxml::xmlbegin(); |
my $start_page= |
$r->print($html.'<head>'. |
&Apache::loncommon::start_page('Preview',undef, |
'</head><body><table border="2"><tr><td>'. |
{'only_body' => 1,}); |
|
|
|
my $end_page = &Apache::loncommon::end_page(); |
|
|
|
$r->print($start_page.'<table border="2"><tr><td>'. |
'<b>Subject:</b> '.$subject.'<br /><br />'. |
'<b>Subject:</b> '.$subject.'<br /><br />'. |
$message.'</td></tr></table></body></html>'); |
$message.'</td></tr></table>'.$end_page); |
} |
} |
|
|
|
|
Line 2678 ENDPREVIEW
|
Line 2660 ENDPREVIEW
|
sub modify_attachments { |
sub modify_attachments { |
my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_; |
my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_; |
my $orig_subject = &Apache::lonnet::unescape($env{'form.subject'}); |
my $orig_subject = &Apache::lonnet::unescape($env{'form.subject'}); |
my $subject=&clear_out_html($orig_subject); |
my $subject=&clear_out_html($orig_subject,undef,1); |
$subject=~s/\n/\<br \/\>/g; |
$subject=~s/\n/\<br \/\>/g; |
$subject=&Apache::lontexconvert::msgtexconverted($subject); |
$subject=&Apache::lontexconvert::msgtexconverted($subject); |
my $timestamp=$env{'form.timestamp'}; |
my $timestamp=$env{'form.timestamp'}; |
my $numoldver=$env{'form.numoldver'}; |
my $numoldver=$env{'form.numoldver'}; |
my $bodytag=&Apache::loncommon::bodytag('Discussion Post Attachments', |
|
'',''); |
|
my $msg = ''; |
my $msg = ''; |
my %attachments = (); |
my %attachments = (); |
my %currattach = (); |
my %currattach = (); |
Line 2692 sub modify_attachments {
|
Line 2673 sub modify_attachments {
|
&extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold); |
&extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold); |
} |
} |
&Apache::lonenc::check_encrypt(\$symb); |
&Apache::lonenc::check_encrypt(\$symb); |
my $html=&Apache::lonxml::xmlbegin(); |
my $js = <<END; |
$r->print(<<END); |
<script type="text/javascript"> |
$html |
|
<head> |
|
<title>Managing Attachments</title> |
|
<script> |
|
function setAction () { |
function setAction () { |
document.modattachments.action = document.modattachments.origpage.value; |
document.modattachments.action = document.modattachments.origpage.value; |
document.modattachments.submit(); |
document.modattachments.submit(); |
} |
} |
</script> |
</script> |
</head> |
END |
$bodytag |
|
|
my $start_page = |
|
&Apache::loncommon::start_page('Discussion Post Attachments',$js); |
|
my $end_page = |
|
&Apache::loncommon::end_page(); |
|
|
|
$r->print(<<END); |
|
$start_page |
<form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb"> |
<form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb"> |
<table border="2"> |
<table border="2"> |
<tr> |
<tr> |
Line 2744 END
|
Line 2728 END
|
<input type="hidden" name="idx" value="$env{'form.idx'}" /> |
<input type="hidden" name="idx" value="$env{'form.idx'}" /> |
<input type="hidden" name="numoldver" value="$env{'form.numoldver'}" /> |
<input type="hidden" name="numoldver" value="$env{'form.numoldver'}" /> |
<input type="hidden" name="origpage" value="$env{'form.origpage'}" /> |
<input type="hidden" name="origpage" value="$env{'form.origpage'}" /> |
<input type="hidden" name="anondiscuss" value="$env{'form.anondiscuss'}" /> |
|
<input type="hidden" name="blog" value="$env{'form.blog'}" /> |
<input type="hidden" name="blog" value="$env{'form.blog'}" /> |
<input type="hidden" name="discuss" value="$env{'form.discuss'}" /> |
<input type="hidden" name="discuss" value="$env{'form.discuss'}" /> |
END |
END |
Line 2757 END
|
Line 2740 END
|
$r->print(<<END); |
$r->print(<<END); |
<input type="button" name="rtntoedit" value="Store Changes" onClick="setAction()"/> |
<input type="button" name="rtntoedit" value="Store Changes" onClick="setAction()"/> |
</form> |
</form> |
</body> |
$end_page |
</html> |
|
END |
END |
return; |
return; |
} |
} |
Line 2811 this.form.submit();" />
|
Line 2793 this.form.submit();" />
|
<input type="hidden" name="subject" /> |
<input type="hidden" name="subject" /> |
<input type="hidden" name="comment" /> |
<input type="hidden" name="comment" /> |
<input type="hidden" name="blog" value = "0" /> |
<input type="hidden" name="blog" value = "0" /> |
<input type="hidden" name="anondiscuss" value = "0" /> |
|
<input type="hidden" name="discuss" value = "0" /> |
<input type="hidden" name="discuss" value = "0" /> |
<input type="hidden" name="numoldver" value="$numoldver" /> |
<input type="hidden" name="numoldver" value="$numoldver" /> |
ENDATTACH |
ENDATTACH |
Line 2991 sub handler {
|
Line 2972 sub handler {
|
# --------------------------- Get query string for limited number of parameters |
# --------------------------- Get query string for limited number of parameters |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export']); |
['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export','sendmessageonly']); |
|
if ($env{'form.editdisc'}) { |
|
if (!(&editing_allowed())) { |
|
my $symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0]; |
|
my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); |
|
my $feedurl=&Apache::lonnet::clutter($url); |
|
&redirect_back($r,$feedurl,&mt('Editing not permitted').'<br />', '0','0','','',$env{'form.previous'},'','','',); |
|
return OK; |
|
} |
|
} |
if ($env{'form.discsymb'}) { |
if ($env{'form.discsymb'}) { |
my ($symb,$feedurl) = &get_feedurl_and_clean_symb($env{'form.discsymb'}); |
my ($symb,$feedurl) = &get_feedurl_and_clean_symb($env{'form.discsymb'}); |
my $readkey = $symb.'_read'; |
my $readkey = $symb.'_read'; |
Line 3021 sub handler {
|
Line 3010 sub handler {
|
} |
} |
if ($env{'form.allversions'}) { |
if ($env{'form.allversions'}) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
|
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
my $html=&Apache::lonxml::xmlbegin(); |
|
my $bodytag=&Apache::loncommon::bodytag('Discussion Post Versions'); |
$r->print(&Apache::loncommon::start_page('Discussion Post Versions')); |
$r->print(<<END); |
|
$html |
|
<head> |
|
<title>Post Versions</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
</head> |
|
$bodytag |
|
END |
|
my $crs='/'.$env{'request.course.id'}; |
my $crs='/'.$env{'request.course.id'}; |
if ($env{'request.course.sec'}) { |
if ($env{'request.course.sec'}) { |
$crs.='_'.$env{'request.course.sec'}; |
$crs.='_'.$env{'request.course.sec'}; |
Line 3052 END
|
Line 3035 END
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname)); |
$r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname)); |
} |
} |
|
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
if ($env{'form.posterlist'}) { |
if ($env{'form.posterlist'}) { |
Line 3120 END
|
Line 3104 END
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); |
my $html=&Apache::lonxml::xmlbegin(); |
my %onload; |
|
if ($env{'environment.remote'} ne 'off') { |
|
$onload{'onload'} = |
|
"if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }"; |
|
} |
|
|
|
my $start_page= |
|
&Apache::loncommon::start_page('New posts marked as read',undef, |
|
{'redirect' => [2,$feedurl], |
|
'only_body' => 1, |
|
'add_entries' => \%onload}); |
|
my $end_page = &Apache::loncommon::end_page(); |
$r->print (<<ENDREDIR); |
$r->print (<<ENDREDIR); |
$html |
$start_page |
<head> |
|
<title>New posts marked as read</title> |
|
<meta http-equiv="pragma" content="no-cache" /> |
|
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
|
</head> |
|
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'> |
|
<img align="right" src="$logo" /> |
<img align="right" src="$logo" /> |
$textline |
$textline |
<form name="reldt" action="$feedurl" target="loncapaclient"> |
<form name="reldt" action="$feedurl" target="loncapaclient"> |
</form> |
</form> |
<br /><a href="$feedurl">Continue</a> |
<br /> |
</body> |
$end_page |
</html> |
|
ENDREDIR |
ENDREDIR |
return OK; |
return OK; |
} elsif ($env{'form.modifydisp'}) { |
} elsif ($env{'form.modifydisp'}) { |
Line 3187 ENDREDIR
|
Line 3175 ENDREDIR
|
my ($symb,$idx)=split(/\:\:\:/,$entry); |
my ($symb,$idx)=split(/\:\:\:/,$entry); |
($symb,my $feedurl)=&get_feedurl_and_clean_symb($symb); |
($symb,my $feedurl)=&get_feedurl_and_clean_symb($symb); |
|
|
|
my $crs='/'.$env{'request.course.id'}; |
|
if ($env{'request.course.sec'}) { |
|
$crs.='_'.$env{'request.course.sec'}; |
|
} |
|
$crs=~s/\_/\//g; |
|
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
|
|
|
if ($env{'form.hide'} && !$seeid && !(&editing_allowed())) { |
|
&redirect_back($r,$feedurl,&mt('Deletion not permitted').'<br />', '0','0','','',$env{'form.previous'},'','','',); |
|
return OK; |
|
} |
|
|
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'}); |
Line 3194 ENDREDIR
|
Line 3194 ENDREDIR
|
my $currenthidden=$contrib{'hidden'}; |
my $currenthidden=$contrib{'hidden'}; |
my $currentstudenthidden=$contrib{'studenthidden'}; |
my $currentstudenthidden=$contrib{'studenthidden'}; |
|
|
my $crs='/'.$env{'request.course.id'}; |
|
if ($env{'request.course.sec'}) { |
|
$crs.='_'.$env{'request.course.sec'}; |
|
} |
|
$crs=~s/\_/\//g; |
|
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
|
|
|
if ($env{'form.hide'}) { |
if ($env{'form.hide'}) { |
$currenthidden.='.'.$idx.'.'; |
$currenthidden.='.'.$idx.'.'; |
unless ($seeid) { |
unless ($seeid) { |
Line 3255 ENDREDIR
|
Line 3248 ENDREDIR
|
# -------------------------------------------------------- Work on attachments |
# -------------------------------------------------------- Work on attachments |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','addnewattach','delnewattach','timestamp','numoldver','idx','anondiscuss','discuss','blog']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','addnewattach','delnewattach','timestamp','numoldver','idx','discuss','blog']); |
my (@currnewattach,@currdelold,@keepold); |
my (@currnewattach,@currdelold,@keepold); |
&process_attachments(\@currnewattach,\@currdelold,\@keepold); |
&process_attachments(\@currnewattach,\@currdelold,\@keepold); |
if (exists($env{'form.addnewattach.filename'})) { |
if (exists($env{'form.addnewattach.filename'})) { |
Line 3289 ENDREDIR
|
Line 3282 ENDREDIR
|
$status=$Apache::inputtags::status[-1]; |
$status=$Apache::inputtags::status[-1]; |
} |
} |
my $discussion = &list_discussion($mode,$status,$symb); |
my $discussion = &list_discussion($mode,$status,$symb); |
my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion'); |
my $start_page = |
$r->print($bodytag.$discussion); |
&Apache::loncommon::start_page('Resource Feedback and Discussion'); |
|
my $end_page = |
|
&Apache::loncommon::end_page(); |
|
$r->print($start_page.$discussion.$end_page); |
return OK; |
return OK; |
} else { |
} else { |
# ------------------------------------------------------------- Normal feedback |
# ------------------------------------------------------------- Normal feedback |
Line 3411 ENDREDIR
|
Line 3407 ENDREDIR
|
my ($typestyle,%to) = &decide_receiver($feedurl); |
my ($typestyle,%to) = &decide_receiver($feedurl); |
|
|
# Actually send mail |
# Actually send mail |
my ($status,$numsent)=&send_msg($feedurl,$email,$citations, |
my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}, |
|
undef,1), |
|
$feedurl,$email,$citations, |
$attachmenturl,%to); |
$attachmenturl,%to); |
|
|
# Discussion? Store that. |
# Discussion? Store that. |
|
|
my $numpost=0; |
my $numpost=0; |
if ($env{'form.discuss'} || $env{'form.anondiscuss'}) { |
if ($env{'form.discuss'} =~/^(?:non|)anon$/ |
my $subject = &clear_out_html($env{'form.subject'}); |
|| $env{'form.anondiscuss'}) { |
my $anonmode=(defined($env{'form.anondiscuss'})); |
my $subject = &clear_out_html($env{'form.subject'},undef,1); |
|
my $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} ); |
$typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl, |
$typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl, |
$subject); |
$subject); |
$numpost++; |
$numpost++; |
Line 3429 ENDREDIR
|
Line 3428 ENDREDIR
|
|
|
my $blog=''; |
my $blog=''; |
if ($env{'form.blog'}) { |
if ($env{'form.blog'}) { |
my $subject = &clear_out_html($env{'form.subject'}); |
my $subject = &clear_out_html($env{'form.subject'},undef,1); |
$status.=&Apache::lonrss::addentry($env{'user.name'}, |
$status.=&Apache::lonrss::addentry($env{'user.name'}, |
$env{'user.domain'}, |
$env{'user.domain'}, |
'CourseBlog_'.$env{'request.course.id'}, |
'CourseBlog_'.$env{'request.course.id'}, |
Line 3477 sub get_feedurl_and_clean_symb {
|
Line 3476 sub get_feedurl_and_clean_symb {
|
my $feedurl = &get_feedurl($symb); |
my $feedurl = &get_feedurl($symb); |
return ($symb,$feedurl); |
return ($symb,$feedurl); |
} |
} |
|
|
|
sub editing_allowed { |
|
my $can_edit = 0; |
|
my $cid = $env{'request.course.id'}; |
|
my $role = (split(/\./,$env{'request.role'}))[0]; |
|
my $section = $env{'request.course.sec'}; |
|
my $allow_editing_config = |
|
$env{'course.'.$cid.'.allow_discussion_post_editing'}; |
|
if ($allow_editing_config =~ m/^\s*yes\s*$/i) { |
|
$can_edit = 1; |
|
} else { |
|
foreach my $editor (split(/,/,$allow_editing_config)) { |
|
my ($editor_role,$editor_sec) = split(/:/,$editor); |
|
if ($editor_role eq $role |
|
&& defined($editor_sec) |
|
&& defined($section) |
|
&& $editor_sec eq $section) { |
|
$can_edit = 1; |
|
last; |
|
} |
|
if ($editor_role eq $role |
|
&& !defined($editor_sec)) { |
|
$can_edit = 1; |
|
} |
|
} |
|
} |
|
return $can_edit; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |