--- loncom/interface/lonfeedback.pm 2006/07/18 17:31:50 1.210 +++ loncom/interface/lonfeedback.pm 2006/11/28 21:44:37 1.218 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.210 2006/07/18 17:31:50 albertel Exp $ +# $Id: lonfeedback.pm,v 1.218 2006/11/28 21:44:37 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -186,8 +186,8 @@ sub list_discussion { push @{$roleinfo{$student}}, 'st:'.$section.':'.$status; } ($classgroups,$studentgroups) = - &Apache::loncoursedata::get_group_memberships($classlist,$keylist, - $cdom,$cnum); + &Apache::loncoursedata::get_group_memberships($classlist,$keylist, + $cdom,$cnum); } # Get discussion display default settings for user @@ -271,11 +271,6 @@ sub list_discussion { my $imsresources; my $copyresult; - my $grp_arg; - if ($group ne '') { - $grp_arg = &grp_args($group); - } - my $function = &Apache::loncommon::get_users_function(); my $color = &Apache::loncommon::designparm($function.'.tabbg', $env{'user.domain'}); @@ -340,9 +335,7 @@ sub list_discussion { if ($newpostsflag) { $chglink .= '&previous='.$prevread; } - if ($group ne '') { - $chglink.='&'.$grp_arg; - } + $chglink.=&group_args($group); if ($visible) { # Print the discusssion @@ -421,25 +414,19 @@ imscp_v1p1.xsd http://www.imsglobal.org/ if ($newpostsflag) { $discussion .= '&previous='.$prevread; } - if ($group ne '') { - $discussion .= '&'.$grp_arg; - } + $discussion .= &group_args($group); $discussion .='">'.&mt('Threaded View').'  '. ''.&mt('Chronological View').'   '.&mt('Sorting/Filtering options').'  '; } else { $discussion .= ''; @@ -448,22 +435,16 @@ imscp_v1p1.xsd http://www.imsglobal.org/ if ($newpostsflag) { $discussion .= '&previous='.$prevread; } - if ($group ne '') { - $discussion .= '&'.$grp_arg; - } + $discussion .= &group_args($group); $discussion .= '">'.&mt('Export').'?  '; if ($newpostsflag) { if (!$markondisp) { $discussion .=''. &mt('Preferences on what is marked as NEW'). '
'.&mt('Mark NEW posts no longer new').''; } else { $discussion .= ' '; @@ -481,9 +462,7 @@ imscp_v1p1.xsd http://www.imsglobal.org/ if ($newpostsflag) { $discussion .= '&previous='.$prevread; } - if ($group ne '') { - $discussion .= '&'.$grp_arg; - } + $discussion .= &group_args($group); $discussion .= '">'.&mt('Show all posts').' '.&mt('to display').' '. $numhidden.' '; if ($showunmark) { @@ -734,8 +713,8 @@ END if ($discussiononly) { my $now = time; my $attachnum = 0; - my $currnewattach; - my $currdelold; + my $currnewattach = []; + my $currdelold = []; my $comment = ''; my $subject = ''; if ($env{'form.origpage'}) { @@ -773,13 +752,13 @@ END if ($outputtarget ne 'tex') { $discussion.=''. - ''. + ''. &mt('Post Discussion').'
'; } } - $discussion.=''. + '">'. &mt('Send Message').''; } return $discussion; @@ -999,9 +978,7 @@ sub build_posting_display { if ($$newpostsflag) { $sender .= '&previous='.$prevread; } - if ($group ne '') { - $sender.='&'.&grp_args($group); - } + $sender .= &group_args($group); $sender .= '" '.$target.'>'.&mt('Edit').''; unless ($seeid) { @@ -1026,9 +1003,7 @@ sub build_posting_display { if ($$newpostsflag) { $sender .= '&previous='.$prevread; } - if ($group ne '') { - $sender.='&'.&grp_args($group); - } + $sender .= &group_args($group); $sender .= '">'.&mt('Hide').''; } $sender.=' '.&mt('Delete').''; } } else { @@ -1074,7 +1047,7 @@ sub build_posting_display { if ($$newpostsflag) { $sender .= '&previous='.$prevread; } - $sender .= '&'.&grp_args($group); + $sender .= &group_args($group); $sender .= '" '.$target.'>'.&mt('Reply').''; } elsif (&Apache::lonnet::allowed('pch', $env{'request.course.id'}. @@ -1216,9 +1189,7 @@ sub build_posting_display { $$discussionitems[$idx] .= &mt('This post has been edited by the author.'); if ($seeid) { $$discussionitems[$idx] .= '  '.&mt('Display all versions').''; } $$discussionitems[$idx].='
'.&mt('Earlier version(s) were posted on: '); @@ -1515,14 +1486,11 @@ END $numoldver = 1; } } - my $message; if ($idx > 0) { my %msgversions = (); &get_post_versions(\%msgversions,$contrib{$idx.':message'},0,$numoldver); - $message = $msgversions{$numoldver}; + $quote = $msgversions{$numoldver}; } - &newline_to_br(\$message); - $quote='
'.&Apache::lontexconvert::msgtexconverted($message).'
'; if ($idx > 0) { my %subversions = (); &get_post_versions(\%subversions,$contrib{$idx.':subject'},1,$numoldver); @@ -1617,6 +1585,11 @@ END &Apache::loncommon::start_page('Resource Feedback and Discussion',$js, {'add_entries' => \%onload}); + if ($quote ne '') { + &newline_to_br(\$quote); + $quote='
'.&Apache::lontexconvert::msgtexconverted($quote).'
'; + } + $r->print(<$title @@ -1712,7 +1685,7 @@ END } } if ($attachmsg) { - $r->print("Retained attachments:$attachmsg
\n"); + $r->print("
Retained attachments:$attachmsg
\n"); } if ($newattachmsg) { $r->print("$newattachmsg
"); @@ -1959,8 +1932,8 @@ sub print_sortfilter_options { unshift(@sections,'all'); # Put 'all' at the front of the list } - foreach (@sections) { - $section_sel .= " \n"; } if (&check_group_priv() eq 'ok') { @@ -1985,8 +1958,8 @@ sub print_sortfilter_options { $numgroupvis = 1; } } - foreach (@groups) { - $group_sel .= " \n"; } my $function = &Apache::loncommon::get_users_function(); @@ -2076,32 +2049,33 @@ $start_page       @@ -2574,9 +2548,9 @@ sub clear_out_html { H1=>1, H2=>1, H3=>1, H4=>1, H5=>1); } # 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; - $message =~ s/(\]*)\>/ + $message =~ s/(\]*)\>/ {($html{uc($2)}&&(length($1)<1000))?"$1\>":"$1\>"}/ge; return $message; } @@ -2841,6 +2815,10 @@ sub show_preview { my ($r) = @_; &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; + my $start_page= + &Apache::loncommon::start_page('Preview',undef, + {'only_body' => 1,}); + my $message=&clear_out_html($env{'form.comment'}); &newline_to_br(\$message); $message=&Apache::lonspeller::markeduptext($message); @@ -2848,9 +2826,6 @@ sub show_preview { my $subject=&clear_out_html($env{'form.subject'},undef,1); $subject=~s/\n/\
/g; $subject=&Apache::lontexconvert::msgtexconverted($subject); - my $start_page= - &Apache::loncommon::start_page('Preview',undef, - {'only_body' => 1,}); my $end_page = &Apache::loncommon::end_page(); @@ -2899,6 +2874,19 @@ ENDPREVIEW sub modify_attachments { my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_; + + my $js = < + function setAction () { + document.modattachments.action = document.modattachments.origpage.value; + document.modattachments.submit(); + } + +END + + my $start_page = + &Apache::loncommon::start_page('Discussion Post Attachments',$js); + my $orig_subject = &unescape($env{'form.subject'}); my $subject=&clear_out_html($orig_subject,undef,1); $subject=~s/\n/\
/g; @@ -2913,17 +2901,7 @@ sub modify_attachments { &extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold); } &Apache::lonenc::check_encrypt(\$symb); - my $js = < - function setAction () { - document.modattachments.action = document.modattachments.origpage.value; - document.modattachments.submit(); - } - -END - my $start_page = - &Apache::loncommon::start_page('Discussion Post Attachments',$js); my $end_page = &Apache::loncommon::end_page(); @@ -2949,7 +2927,7 @@ END } } } - if (@{$currnewattach} > 0) { + if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) { $r->print("The following attachments have been uploaded for inclusion with this posting.
Check the checkboxes for any you wish to remove
\n"); foreach (@{$currnewattach}) { $_ =~ m#/([^/]+)$#; @@ -3197,8 +3175,9 @@ sub sort_filter_names { ); %{$status_types} = ( all => 'Roles of any status', - Active => 'Only active roles', - Expired => 'Only inactive roles' + Active => 'Only active roles', + Expired => 'Only past roles', + Future => 'Only future roles', ); } @@ -3794,11 +3773,12 @@ sub check_group_priv { return ''; } -sub grp_args { +sub group_args { my ($group) = @_; - my $extra_args = 'group='.$group; + if ($group eq '') { return ''; } + my $extra_args = '&group='.$group; if (exists($env{'form.ref'})) { - $extra_args .= '&ref='.$env{'form.ref'}; + $extra_args .= '&ref='.$env{'form.ref'}; } return $extra_args; }