--- loncom/interface/lonfeedback.pm 2010/08/27 16:37:23 1.290.2.5
+++ loncom/interface/lonfeedback.pm 2010/04/14 13:58:11 1.292
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.290.2.5 2010/08/27 16:37:23 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.292 2010/04/14 13:58:11 wenzelju Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -49,24 +49,15 @@ use LONCAPA;
sub discussion_open {
my ($status,$symb)=@_;
-# Advanced roles can always discuss
if ($env{'request.role.adv'}) { return 1; }
-# Get discussion closing date
- my $close=&Apache::lonnet::EXT('resource.0.discussend',$symb);
-# If it is defined and in the future, the instructor wants this discussion to be open
- if (defined($close) && $close ne '' && $close > time) {
- return 1;
- }
-# It was not explicitly open, check if the problem is available.
-# If the problem is not available, close the discussion
if (defined($status) &&
- !($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER'
- || $status eq 'OPEN')) {
- return 0;
+ !($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER'
+ || $status eq 'OPEN')) {
+ return 0;
}
-# The problem is available, but check if the instructor explictly closed discussion
+ my $close=&Apache::lonnet::EXT('resource.0.discussend',$symb);
if (defined($close) && $close ne '' && $close < time) {
- return 0;
+ return 0;
}
return 1;
}
@@ -282,10 +273,6 @@ sub list_discussion {
my %anonhash=();
my $anoncnt=0;
my $target='';
- unless ($env{'browser.interface'} eq 'textual' ||
- $env{'environment.remote'} eq 'off' ) {
- $target='target="LONcom"';
- }
my $now = time;
$discinfo{$visitkey} = $visit;
@@ -326,7 +313,6 @@ sub list_discussion {
'dpwn' => 'Deleted posts will no longer be visible to you and other students',
'bwco' => 'but will continue to be visible to your instructor',
'depo' => 'Deleted posts will no longer be visible to you or anyone else.',
- 'discussions' => 'DISCUSSIONS'
);
my $currdisp = $lt{'allposts'};
@@ -378,7 +364,8 @@ sub list_discussion {
# Print the discusssion
if ($outputtarget eq 'tex') {
$discussion.='
Reply: '.$thisdepth.'';
}
$discussionitems[$alldiscussion{$post}]=~s/<\/td>
';
my $escsymb=&escape($ressymb);
- if ($visible) {
+ if ($visible>2) {
$discussion .= '
@@ -870,7 +842,7 @@ sub postingform_display {
$lt{'note'} $lt{'title'}: - + ENDDISCUSS if ($env{'form.origpage'}) { $postingform .= '\n"; - $postingform .= &generate_attachments_button('',$attachnum,$ressymb, - $now,$currnewattach, - $currdelold,'',$mode, - $blockblog); - if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) { - $newattachmsg = ' '.$lt{'newa'}.' '; - if (@{$currnewattach} > 1) { - $newattachmsg .= '
'.$lt{'newa'}.' '; + if (@{$currnewattach} > 1) { + $newattachmsg .= '
'."\n"; } - $newattachmsg .= ' '."\n"; } + $postingform .= $newattachmsg; + $postingform .= &generate_preview_button(); } - $postingform .= $newattachmsg; - $postingform .= &generate_preview_button(); return $postingform; } @@ -932,19 +906,6 @@ sub build_posting_display { if ((@{$grouppick} == 0) || (grep(/^all$/,@{$grouppick}))) { $skip_group_check = 1; } - my (%deletions,%hiddens); - if ($contrib{'deleted'}) { - my $deleted = $contrib{'deleted'}; - $deleted =~ s/^\.//; - $deleted =~ s/\.$//; - %deletions = map { $_ => 1 } (split(/\.\./,$deleted)); - } - if ($contrib{'hidden'}) { - my $hidden = $contrib{'hidden'}; - $hidden =~ s/^\.//; - $hidden =~ s/\.$//; - %hiddens = map { $_ => 1 } (split(/\.\./,$hidden)); - } if ($contrib{'version'}) { my $oldest = $contrib{'1:timestamp'}; if ($prevread eq '0') { @@ -958,13 +919,13 @@ sub build_posting_display { } for (my $id=1;$id<=$contrib{'version'};$id++) { my $idx=$id; - next if ($contrib{$idx.':deleted'}); - next if ($contrib{$idx.':hidden'}); my $posttime = $contrib{$idx.':timestamp'}; if ($prevread <= $posttime) { $$newpostsflag = 1; } + my $hidden=($contrib{'hidden'}=~/\.$idx\./); my $studenthidden=($contrib{'studenthidden'}=~/\.$idx\./); + my $deleted=($contrib{'deleted'}=~/\.$idx\./); my $origindex='0.'; my $numoldver=0; if ($contrib{$idx.':replyto'}) { @@ -988,7 +949,7 @@ sub build_posting_display { } else { $$replies[$$depth[$idx]]=1; } - unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx})) { + unless ((($hidden) && (!$seeid)) || ($deleted)) { $$visible++; if ($contrib{$idx.':history'}) { if ($contrib{$idx.':history'} =~ /:/) { @@ -1022,7 +983,7 @@ sub build_posting_display { $message.=$attachtxt{$numoldver}; $subject=$subjects{$numoldver}; if ($message) { - if ($hiddens{$idx}) { + if ($hidden) { $message=''.$message.''; if ($studenthidden) { $message .=' Deleted by poster (student).'; @@ -1086,48 +1047,46 @@ sub build_posting_display { } else { @{$$namesort{$lastname}{$firstname}} = ("$idx"); } - if ($outputtarget ne 'tex') { - if (&editing_allowed($escsymb.':::'.$idx,$group)) { - if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) { - $sender.=' '.&mt('Edit').''; + if (&editing_allowed($escsymb.':::'.$idx,$group)) { + if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) { + $sender.=' '.&mt('Edit').''; - unless ($seeid) { - my $grpargs = &group_args($group); - $sender.=" '; - } + unless ($seeid) { + my $grpargs = &group_args($group); + $sender.=" '; } } - if ($seeid) { - if ($hiddens{$idx}) { - unless ($studenthidden) { - $sender.=' '.&mt('Make Visible').''; - } - } else { - $sender.=' '; - } - my $grpargs = &group_args($group); - $sender.= - " "; - $sender .= &mt('Delete').''; - } + $sender .= '">'.&mt('Make Visible').''; + } + } else { + $sender.=' '.&mt('Hide').''; + } + my $grpargs = &group_args($group); + $sender.= + " "; + $sender .= &mt('Delete').''; } } else { if ($screenname) { @@ -1155,38 +1114,36 @@ sub build_posting_display { @{$$namesort{'__anon'}{'__anon'}} = ("$idx"); } } - if ($outputtarget ne 'tex') { - if (&discussion_open($status)) { - if (($group ne '') && - (&check_group_priv($group,'pgd') eq 'ok')) { - $sender.=' '.&mt('Reply').''; - } elsif (&Apache::lonnet::allowed('pch', - $env{'request.course.id'}. - ($env{'request.course.sec'}?'/'. - $env{'request.course.sec'}:''))) { - $sender.=' '.&mt('Reply').''; + if (&discussion_open($status)) { + if (($group ne '') && + (&check_group_priv($group,'pgd') eq 'ok')) { + $sender.=' '.&mt('Reply').''; + } elsif (&Apache::lonnet::allowed('pch', + $env{'request.course.id'}. + ($env{'request.course.sec'}?'/'. + $env{'request.course.sec'}:''))) { + $sender.=' '.&mt('Reply').''; } - if ($viewgrades) { + } + if ($viewgrades) { $vgrlink=&Apache::loncommon::submlink(&mt('Submissions'), - $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb); - } - if ($$dischash{$readkey}=~/\.$idx\./) { - $ctlink = ''; - } else { - $ctlink = ''; - } + $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb); + } + if ($$dischash{$readkey}=~/\.$idx\./) { + $ctlink = ''; + } else { + $ctlink = ''; } } #figure out at what position this needs to print @@ -1203,7 +1160,7 @@ sub build_posting_display { if ($outputtarget eq 'export') { %{$$imsitems{$idx}} = (); $$imsitems{$idx}{'isvisible'}='true'; - if ($hiddens{$idx}) { + if ($hidden) { $$imsitems{$idx}{'isvisible'}='false'; } $$imsitems{$idx}{'title'}=$subjects{$numoldver}; @@ -1285,7 +1242,7 @@ sub build_posting_display { $$newitem{$idx} = 1; $$discussionitems[$idx] .= '
|