--- loncom/interface/lonfeedback.pm 2010/02/14 17:20:19 1.273.4.8 +++ loncom/interface/lonfeedback.pm 2009/11/26 05:21:43 1.280 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.273.4.8 2010/02/14 17:20:19 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.280 2009/11/26 05:21:43 faziophi Exp $ # # Copyright Michigan State University Board of Trustees # @@ -91,7 +91,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') { @@ -103,9 +103,12 @@ sub list_discussion { my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('boards'); if ($blocked) { + $blocktext = '
'; + }else{ + $blocktext.=""; } return $blocktext; } @@ -171,7 +174,6 @@ sub list_discussion { 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 = (); my %roleinfo = (); @@ -354,10 +356,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); @@ -400,8 +402,8 @@ sub list_discussion { my $manifestfilename = $tempexport.$manifest; if ($manifestfile = Apache::File->new('>'.$manifestfilename)) { $manifestok=1; - print $manifestfile qq| - + print $manifestfile qq| + '. ''.&mt('Show all posts').' '.&mt('to display').' '. @@ -528,11 +530,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; @@ -567,7 +569,7 @@ imscp_v1p1.xsd http://www.imsglobal.org/ + $lt{'cuse'}:
- $lt{'cuse'}:  END @@ -589,7 +591,7 @@ END   - $lt{'chgt'}? + $lt{'chgt'}?
@@ -757,9 +759,9 @@ sub send_feedback_link { my $output = ''. ' '. - ''.&mt('Post Discussion').''; + '" border="0" />'.&mt('Post Discussion').''; return $output; } @@ -767,9 +769,9 @@ sub send_message_link { my ($ressymb) = @_; my $output = ''. ' '.&mt('Send Feedback').''; + '" border="0" />'.&mt('Send Feedback').''; return $output; } @@ -782,7 +784,7 @@ sub action_links_bar { if ($visible>2) { $discussion .= ''.&mt('Threaded View').'  '. @@ -813,7 +815,7 @@ sub action_links_bar { &mt('Preferences on what is marked as NEW'). '
'.&mt('Mark NEW posts no longer new').''; + $discussion .= '">'.&mt('Mark NEW posts no longer new').''; } else { $discussion .= ' '; } @@ -846,7 +848,7 @@ sub postingform_display {
$lt{'note'}
$lt{'title'}: 

- + ENDDISCUSS if ($env{'form.origpage'}) { $postingform .= '['.$$anonhash{$key}.']
'. $screenname; @@ -1022,7 +1023,6 @@ sub build_posting_display { if ($see_anonymous) { $sender.=&Apache::loncommon::student_image_tag($contrib{$idx.':senderdomain'},$contrib{$idx.':sendername'}); } - $sender = ''.$sender.''; # Set up for sorting by domain, then username unless (defined($$usernamesort{$contrib{$idx.':senderdomain'}})) { %{$$usernamesort{$contrib{$idx.':senderdomain'}}} = (); @@ -1057,7 +1057,7 @@ sub build_posting_display { $sender.=' '.&mt('Edit').''; @@ -1083,7 +1083,7 @@ sub build_posting_display { $sender.=' '.&mt('Hide').''; @@ -1124,7 +1124,7 @@ sub build_posting_display { $sender.=' '.&mt('Reply').''; @@ -1245,24 +1245,24 @@ sub build_posting_display { if ($prevread > 0 && $prevread <= $posttime) { $$newitem{$idx} = 1; $$discussionitems[$idx] .= ' - +

'; } else { $$newitem{$idx} = 0; $$discussionitems[$idx] .= ' -
'.&mt('NEW').'
+

'; } $$discussionitems[$idx] .= ''; if ($$dischash{$toggkey}) { $$discussionitems[$idx].=''; } $$discussionitems[$idx].= '
   '. ''.$subject.'  '. - $sender.' '.$vgrlink.' ('. + $sender.' '.$vgrlink.' ('. &Apache::lonlocal::locallocaltime($posttime).')  '. $ctlink.'
'. - $message.'
'; + $message.'

'; if ($contrib{$idx.':history'}) { my @postversions = (); $$discussionitems[$idx] .= &mt('This post has been edited by the author.'); @@ -1397,9 +1397,7 @@ sub get_post_contents { my ($timesent,$attachmsg); my %currattach = (); $timesent = &Apache::lonlocal::locallocaltime($postversions[$i]); - unless (&contains_block_html($messages->{$i})) { - &newline_to_br(\$messages->{$i}); - } + &newline_to_br(\$messages->{$i}); $$messages{$i}=&Apache::lontexconvert::msgtexconverted($$messages{$i}); $$subjects{$i}=~s/\n/\
/g; $$subjects{$i}=&Apache::lontexconvert::msgtexconverted($$subjects{$i}); @@ -1413,7 +1411,7 @@ sub get_post_contents { foreach my $key (sort(keys(%currattach))) { if ($$allattachments{$key}{'filename'} =~ m-^/uploaded/([^/]+/[^/]+)(/feedback)?(/?\d*)/([^/]+)$-) { my $fname = $1.$3.'/'.$4; - $$imsfiles{$idx}{$i} .= ''."\n"; + $$imsfiles{$idx}{$i} .= ''."\n"; $$attachtxt{$i}.= ''.$4.'
'; } } @@ -1667,16 +1665,18 @@ END END + # Breadcrumbs + my $brcrum = [{'href' => '', + 'text' => 'Resource Feedback and Discussion'}]; + my %onload = ('onload' => 'window.focus();setposttype();'); my $start_page= &Apache::loncommon::start_page('Resource Feedback and Discussion',$js, - {'add_entries' => \%onload}); + {'add_entries' => \%onload, + 'bread_crumbs' => $brcrum,}); if ($quote ne '') { - $quote = &HTML::Entities::decode($quote); - unless (&contains_block_html($quote)) { - &newline_to_br(\$quote); - } + &newline_to_br(\$quote); $quote='
'.&Apache::lontexconvert::msgtexconverted($quote).'
'; } @@ -1708,8 +1708,9 @@ $latexHelp

$lt{'title'}:

-

+

END if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) { if ($env{'form.origpage'}) { @@ -1731,7 +1732,6 @@ END } } else { $r->print(< $lt{'atta'} $attachmaxtext:

END @@ -1745,7 +1745,7 @@ END $r->print(< - +

END @@ -1952,9 +1952,9 @@ END $r->print(<$lt{'disa'} $lt{$discdisp} - +
- + END $r->print(&Apache::loncommon::end_data_table_row()); @@ -1969,7 +1969,7 @@ END $r->print(<$lt{'dotm'} $lt{$disctogg} - + END my $save = &mt('Save'); $r->print(&Apache::loncommon::end_data_table_row()); @@ -1983,7 +1983,7 @@ END - + END if (exists($env{'form.group'})) { $r->print(''); @@ -2021,7 +2021,7 @@ sub print_sortfilter_options { $ccrole = 'co'; } push(@courseroles,$ccrole); - + if ($env{'request.course.sec'} !~ /^\s*$/) { #Restrict section choice to current section @sections = ('all',$env{'request.course.sec'}); $numvisible = 2; @@ -2136,17 +2136,17 @@ $start_page

- - - - - - - - - - - + + + + + + + + + + +
$lt{'soor'} $lt{'sprs'} $lt{'spur'} $lt{'spse'} $lt{'spgr'} $lt{'psub'}$lt{'soor'} $lt{'sprs'} $lt{'spur'} $lt{'spse'} $lt{'spgr'} $lt{'psub'}
@@ -2201,7 +2201,7 @@ $start_page
- + END if (exists($env{'form.group'})) { $r->print(''); @@ -2324,7 +2324,7 @@ END
- + $end_page END @@ -2427,7 +2427,7 @@ sub redirect_back { if ($previous > 0) { $qrystr = 'previous='.$previous; if ($feedurl =~ /\?register=1/) { - $feedurl .= '&'.$qrystr; + $feedurl .= '&'.$qrystr; } else { $feedurl .= '?'.$qrystr; } @@ -2436,14 +2436,14 @@ sub redirect_back { if (defined($sort)) { my $sortqry = 'sortposts='.$sort; if (($feedurl =~ /\?register=1/) || ($feedurl =~ /\?previous=/)) { - $feedurl .= '&'.$sortqry; + $feedurl .= '&'.$sortqry; } else { $feedurl .= '?'.$sortqry; } $sorttag = ''; if (defined($numpicks)) { my $userpickqry = 'totposters='.$numpicks; - $feedurl .= '&'.$userpickqry; + $feedurl .= '&'.$userpickqry; $userpicktag = ''; } else { if (ref($sectionpick) eq 'ARRAY') { @@ -2457,7 +2457,7 @@ sub redirect_back { $sectag =~ s/,$//; $sectag .= '" />'; } else { - $feedurl .= '&sectionpick='.$sectionpick; + $feedurl .= '§ionpick='.$sectionpick; $sectag = ''; } if (ref($grouppick) eq 'ARRAY') { @@ -2471,7 +2471,7 @@ sub redirect_back { $grptag =~ s/,$//; $grptag .= '" />'; } else { - $feedurl .= '&grouppick='.$grouppick; + $feedurl .= '&grouppick='.$grouppick; $grptag = ''; } if (ref($rolefilter) eq 'ARRAY') { @@ -2488,7 +2488,7 @@ sub redirect_back { $feedurl .= '&rolefilter='.$rolefilter; $roletag = ''; } - $feedurl .= '&statusfilter='.$statusfilter; + $feedurl .= '&statusfilter='.$statusfilter; $statustag =''; } } @@ -2630,11 +2630,10 @@ sub screen_header { $env{'request.course.id'}. ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { $discussoptions='
'. - + $contribdisc. + '
'. ''.&mt('Change Screenname').''; my $blockblog = &Apache::loncommon::blocking_status('blogs'); if (!$blockblog) { @@ -2648,7 +2647,7 @@ sub screen_header { .$msgoptions; } if ($discussoptions) { - $discussoptions='

' + $discussoptions='

' .' '.&mt('Discussion Contributions').'

'.&Apache::lonhtmlcommon::coursepreflink(&mt('Discussion Settings'),'discussion').'

' .$discussoptions; } @@ -2680,13 +2679,11 @@ sub clear_out_html { ($override)) { # allows


      • #

        - # + # %html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1, BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1, M=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1, - H1=>1, H2=>1, H3=>1, H4=>1, H5=>1, H6=>1, - TABLE=>1, TR=>1, TD=>1, TH=>1, TBODY=>1); - + H1=>1, H2=>1, H3=>1, H4=>1, H5=>1); } # Do the substitution of everything that is not explicitly allowed $message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/ @@ -2703,6 +2700,9 @@ sub assemble_email { 'orig' => 'Original screen output (if applicable)', 'corr' => 'Correct Answer(s) (if applicable)', ); + if (&Apache::loncommon::course_type() eq 'Community') { + $lt{'prev'} = &mt('Previous attempts of member (if applicable)'); + } my $email=<<"ENDEMAIL"; $message ENDEMAIL @@ -2950,19 +2950,18 @@ sub show_preview { } sub contains_block_html { - my ($message)=@_; - return ($message =~ m{ - <(br|h1|h2|h3|h4|h5|h6|p|ol|ul|table|pre|address|blockquote|center|div) - \s* - (\w+\=['"]\w+['"])* - \s* - ( - \s*/>| - >.* - )}xs - ); + my ($message)=@_; + return ($message =~ m/ + <(br|h1|h2|h3|h4|h5|h6|p|ol|ul|table|pre|address|blockquote|center|div) + [\s]* + ([\w]+\=['"][\w]+['"])* + [\s]* + ( + [\s]*[\/]>| + >.*<\/\1[\s]*> + )/x ); } - + sub newline_to_br { my ($message)=@_; my $newmessage; @@ -2995,7 +2994,7 @@ sub generate_preview_button { +onClick="if (typeof(document.$formname.onsubmit)=='function') {document.$formname.onsubmit();};this.form.comment.value=document.$formname.$fieldname.value;this.form.subject.value=document.$formname.subject.value;this.form.submit();" /> ENDPREVIEW } @@ -3021,8 +3020,12 @@ sub modify_attachments { END + # Breadcrumbs + my $brcrum = [{'href' => '', + 'text' => 'Discussion Post Attachments'}]; my $start_page = - &Apache::loncommon::start_page('Discussion Post Attachments',$js); + &Apache::loncommon::start_page('Discussion Post Attachments',$js, + {'bread_crumbs' => $brcrum,}); my $orig_subject = &unescape($env{'form.subject'}); my $subject=&clear_out_html($orig_subject,undef,1); @@ -3050,7 +3053,7 @@ $toolarge
        @@ -3101,7 +3104,7 @@ END $r->print(''."\n"); } $r->print(< + $end_page END @@ -3364,14 +3367,14 @@ sub sort_filter_names { } if (ref($status_types) eq 'HASH') { %{$status_types} = ( - all => 'Roles of any status', - Active => 'Only active roles', - Expired => 'Only past roles', - Future => 'Only future roles', - ); + all => 'Roles of any status', + Active => 'Only active roles', + Expired => 'Only past roles', + Future => 'Only future roles', + ); } } - + sub handler { my $r = shift; if ($r->header_only) { @@ -3431,7 +3434,13 @@ sub handler { &Apache::loncommon::no_cache($r); $r->send_http_header; - $r->print(&Apache::loncommon::start_page('Discussion Post Versions')); + # Breadcrumbs + my $brcrum = [{'href' => '', + 'text' => 'Discussion Post Versions'}]; + + $r->print(&Apache::loncommon::start_page('Discussion Post Versions',undef, + {'bread_crumbs' => $brcrum,}) + ); my $crs='/'.$env{'request.course.id'}; if ($env{'request.course.sec'}) {
        - Subject: $subject

        + Subject: $subject

        END if ($idx) { if ($attachmenturls) { @@ -3078,7 +3081,7 @@ END
        - $lt{'adda'} + $lt{'adda'}