--- loncom/interface/lonfeedback.pm 2012/06/17 15:35:15 1.290.2.7.2.6 +++ loncom/interface/lonfeedback.pm 2012/01/07 22:03:01 1.329 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.290.2.7.2.6 2012/06/17 15:35:15 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.329 2012/01/07 22:03:01 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -58,15 +58,15 @@ sub discussion_open { return 1; } # It was not explicitly open, check if the problem is available. -# If the problem is not available, close the discussion +# 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 if (defined($close) && $close ne '' && $close < time) { - return 0; + return 0; } return 1; } @@ -82,26 +82,6 @@ sub discussion_visible { return 1; } -sub discussion_vote_available { - my ($status,$symb)=@_; - my $canvote=&Apache::lonnet::EXT('resource.0.discussvote',$symb); - if ((lc($canvote) eq 'yes') || - ((lc($canvote) eq 'notended') && (&discussion_open($status,$symb)))) { - return 1; - } -} - -sub get_realsymb { - my ($symb) = @_; - my $realsymb = $symb; - if ($symb=~/^bulletin___/) { - my $filename=(&Apache::lonnet::decode_symb($symb))[2]; - $filename=~s{^adm/wrapper/}{}; - $realsymb=&Apache::lonnet::symbread($filename); - } - return $realsymb; -} - sub list_discussion { my ($mode,$status,$ressymb,$imsextras,$group)=@_; unless ($ressymb) { $ressymb=&Apache::lonnet::symbread(); } @@ -155,7 +135,7 @@ sub list_discussion { $crs=~s/\_/\//g; my $encsymb=&Apache::lonenc::check_encrypt($ressymb); my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs) - && ($ressymb=~/\.(problem|exam|quiz|assess|survey|form|task)$/)); + && ($ressymb=~/$LONCAPA::assess_re/)); my %usernamesort = (); my %namesort =(); @@ -277,14 +257,14 @@ sub list_discussion { $visit ++; my $seeid; - if (&Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { - $seeid = 1; + if (($group ne '') && ($mode eq 'board') && + ($ressymb =~ m|^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$|)) { + if (&check_group_priv($group,'dgp') eq 'ok') { + $seeid = 1; + } + } else { + $seeid=&Apache::lonnet::allowed('rin',$crs); } - my $seehidden = &can_see_hidden($mode,$ressymb,undef,$group,$cdom,$cnum,$crs); -# Is voting on discussions available - my $realsymb = &get_realsymb($ressymb); - my $canvote = &discussion_vote_available($status,$realsymb); - my @discussionitems=(); my %shown = (); my @posteridentity=(); @@ -301,17 +281,12 @@ sub list_discussion { my $maxdepth=0; 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; &Apache::lonnet::put('nohist_'.$cid.'_discuss',\%discinfo,$env{'user.domain'},$env{'user.name'}); - &build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$seehidden,$canvote,$prevread,$sortposts,$encsymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,\@grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,\%anonhash,$anoncnt,$group); + &build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$encsymb,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,\@grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,\%anonhash,$anoncnt,$group); my $discussion=''; my $manifestfile; @@ -321,10 +296,8 @@ sub list_discussion { my $copyresult; my $function = &Apache::loncommon::get_users_function(); - my $color = &Apache::loncommon::designparm($function.'.tabbg', - $env{'user.domain'}); my %lt = &Apache::lonlocal::texthash( - 'cuse' => 'Current discussion settings', + 'cuse' => 'My settings for this discussion', 'allposts' => 'All posts', 'unread' => 'New posts only', 'unmark' => 'Unread only', @@ -445,7 +418,6 @@ imscp_v1p1.xsd http://www.imsglobal.org/ } } else { my $colspan=$maxdepth+1; -#JW $discussion.= &Apache::lonhtmlcommon::scripttag(qq| function verifydelete (caller,symb,idx,newflag,previous,groupparm) { var symbparm = symb+':::'+idx @@ -467,10 +439,10 @@ imscp_v1p1.xsd http://www.imsglobal.org/ } |); $discussion.='
'. - "\n".''; + "\n".'
'; $discussion .= &action_links_bar($colspan,$ressymb,$visible, $newpostsflag,$group, - $prevread,$markondisp,$seehidden); + $prevread,$markondisp); my $escsymb=&escape($ressymb); my $numhidden = keys(%notshown); if ($numhidden > 0) { @@ -530,7 +502,7 @@ imscp_v1p1.xsd http://www.imsglobal.org/ my $thisdepth=$depth[$alldiscussion{$post}]; if ($outputtarget ne 'tex' && $outputtarget ne 'export') { for (1..$thisdepth) { - $discussion.=''; + $discussion.=''; } } my $colspan=$maxdepth-$thisdepth+1; @@ -588,17 +560,12 @@ imscp_v1p1.xsd http://www.imsglobal.org/ unless ($outputtarget eq 'tex' || $outputtarget eq 'export') { my $colspan=$maxdepth+1; $discussion .= < -