--- loncom/interface/lonfeedback.pm 2008/11/18 19:14:22 1.256 +++ loncom/interface/lonfeedback.pm 2010/08/26 09:09:24 1.290.2.3 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.256 2008/11/18 19:14:22 jms Exp $ +# $Id: lonfeedback.pm,v 1.290.2.3 2010/08/26 09:09:24 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -27,133 +27,6 @@ # ### -=pod - -=head1 NAME - -Apache::lonfeedback.pm - -=head1 SYNOPSIS - -Handles feedback from students to instructors and system administrators. - -Provides a screenshot of the current resource, as well as previous attempts if the resource was a homework. - -Used by lonmsg.pm. - -This is part of the LearningOnline Network with CAPA project -described at http://www.lon-capa.org. - -=head1 OVERVIEW - -None - -=head1 SUBROUTINES - -=over - -=item discussion_open() - -=item discussion_visible() - -=item list_discussion() - -=item send_feedback_link() - -=item send_message_link() - -=item action_links_bar() - -=item postingform_display() - -=item build_posting_display - -=item filter_regexp() - -=item get_post_contents() - -=item replicate_attachments() - -=item mail_screen() - -=item print_display_options() - -=item print_sortfilter_options() - -=item print_showposters() - -=item get_post_versions() - -=item get_post_attachments() - -=item fail_redirect() - -=item redirect_back() - -=item no_redirect_back() - -=item screen_header() - -=item resource_output() - -=item clear_out_html() - -=item assemble_email() - -=item feedback_available() - -=item send_msg() - -=item adddiscuss() - -=item get_discussion_info() - -=item show_preview() - -=item newline_to_br() - -=item generate_preview_button() - -=item modify_attachments() - -=item process_attachments() - -=item generate_attachments_button() - -=item extract_attachments() - -=item construct_attachmenturl() - -=item add_blog_checkbox() - -=item has_discussion() - -=item sort_filter_names() - -=item handler() - -=item blocked_reply_or_edit() - -=item wrap_symb() - -=item dewrapper() - -=item get_feedurl() - -=item get_feedurl_and_clean_symb() - -=item editing_allowed() - -=item check_group_priv() - -=item group_args() - -=item get_resource_title() - -=back - -=cut - package Apache::lonfeedback; use strict; @@ -168,6 +41,7 @@ use Apache::lonnavmaps; use Apache::lonenc(); use Apache::lonrss(); use HTML::LCParser(); +#use HTML::Tidy::libXML; use Apache::lonspeller(); use Apache::longroup; use Cwd; @@ -175,15 +49,24 @@ 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; } - my $close=&Apache::lonnet::EXT('resource.0.discussend',$symb); +# 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; } @@ -218,7 +101,7 @@ sub list_discussion { if (not &discussion_visible($status)) { if ($mode ne 'board') { &Apache::lonenc::check_encrypt(\$ressymb); - return '
'.&send_message_link($ressymb); + return '
"; } } if ($group ne '' && $mode eq 'board') { @@ -230,14 +113,17 @@ sub list_discussion { my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('boards'); if ($blocked) { + $blocktext = '
'; + }else{ + $blocktext.=""; } return $blocktext; } - my @bgcols = ("#cccccc","#eeeeee"); + my @bgcols = ("LC_disc_old_item","LC_disc_new_item"); my $discussiononly=0; if ($mode eq 'board') { $discussiononly=1; } unless ($env{'request.course.id'}) { return ''; } @@ -296,6 +182,7 @@ sub list_discussion { my $cdom = $env{'course.'.$cid.'.domain'}; my $cnum = $env{'course.'.$cid.'.num'}; + my $crstype = &Apache::loncommon::course_type(); # Get information about students and non-students in course for filtering display of posts my %roleshash = (); @@ -439,6 +326,7 @@ 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'}; @@ -479,10 +367,10 @@ sub list_discussion { $togglink = 'toggoff'; } - $chglink .= '&changes='.$displinkA.'_'.$displinkB.'_'.$marklink.'_'.$togglink; + $chglink .= '&changes='.$displinkA.'_'.$displinkB.'_'.$marklink.'_'.$togglink; if ($newpostsflag) { - $chglink .= '&previous='.$prevread; + $chglink .= '&previous='.$prevread; } $chglink.=&group_args($group); @@ -490,8 +378,7 @@ sub list_discussion { # Print the discusssion if ($outputtarget eq 'tex') { $discussion.='{\tiny \vskip 0 mm\noindent\makebox[2 cm][b]{\hrulefill}'. - '\textbf{DISCUSSIONS}\makebox[2 cm][b]{\hrulefill}'. - '\vskip 0 mm\noindent\textbf{'.$lt{'cuse'}.'}:\vskip 0 mm'. + '\textbf{'.$lt{'discussions'}.'}\makebox[2 cm][b]{\hrulefill}\vskip 0 mm'. '\noindent\textbf{'.$lt{'disa'}.'}: \textit{'.$currdisp.'}\vskip 0 mm'. '\noindent\textbf{'.$lt{'npce'}.'}: \textit{'.$currmark.'}}'; } elsif ($outputtarget eq 'export') { @@ -525,8 +412,7 @@ sub list_discussion { my $manifestfilename = $tempexport.$manifest; if ($manifestfile = Apache::File->new('>'.$manifestfilename)) { $manifestok=1; - print $manifestfile qq| - + print $manifestfile qq| - |; - $discussion.='
'; + |); + $discussion.=''. + "\n".'
'; $discussion .= &action_links_bar($colspan,$ressymb,$visible, $newpostsflag,$group, $prevread,$markondisp); @@ -572,7 +458,7 @@ imscp_v1p1.xsd http://www.imsglobal.org/ $discussion.="\n".''; } @@ -684,14 +569,14 @@ imscp_v1p1.xsd http://www.imsglobal.org/ my $colspan=$maxdepth+1; $discussion .= < -
'. ''.&mt('Show all posts').' '.&mt('to display').' '. @@ -637,7 +523,6 @@ imscp_v1p1.xsd http://www.imsglobal.org/ $threadinsert='
Reply: '.$thisdepth.''; } $discussionitems[$alldiscussion{$post}]=~s/<\/td>]*)>/$threadinsert<\/td>
/; - $discussionitems[$alldiscussion{$post}]=~s/]+)>(Edit|Hide|Delete|Reply|Submissions)<\/a>//g; $discussionitems[$alldiscussion{$post}]=~s/(|<\/b>|<\/a>|]+)>)//g; $discussionitems[$alldiscussion{$post}]='\vskip 0 mm\noindent\makebox[2 cm][b]{\hrulefill}'.$discussionitems[$alldiscussion{$post}]; @@ -652,11 +537,11 @@ imscp_v1p1.xsd http://www.imsglobal.org/ print $manifestfile "\n". ''. - ''.$imsitems{$alldiscussion{$post}}{'title'}.''; + ''.$imsitems{$alldiscussion{$post}}{'title'}.''; $imsresources .= "\n". ''."\n". ''."\n". - $imsfiles{$alldiscussion{$post}}{$imsitems{$alldiscussion{$post}}{'currversion'}}."\n". + $imsfiles{$alldiscussion{$post}}{$imsitems{$alldiscussion{$post}}{'currversion'}}.''."\n". ''; } my $postingfile; @@ -674,7 +559,7 @@ imscp_v1p1.xsd http://www.imsglobal.org/ } $copyresult.=&replicate_attachments($imsitems{$alldiscussion{$post}}{'allattachments'},$tempexport); } else { - $discussion.=''. $discussionitems[$alldiscussion{$post}]. '
- +