--- loncom/interface/lonfeedback.pm 2006/12/11 04:10:35 1.235 +++ loncom/interface/lonfeedback.pm 2009/03/18 02:44:33 1.255.2.4 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.235 2006/12/11 04:10:35 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.255.2.4 2009/03/18 02:44:33 raeburn 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 '
'.&send_message_link($ressymb); } } if ($group ne '' && $mode eq 'board') { @@ -625,7 +625,7 @@ END $filterchoice .= ' '.$role_types{$role}.','; } $filterchoice =~ s/,$//; - $filterchoice .= '
        '; + $filterchoice .= '
'.(' ' x8); } if ($statusfilter) { $filterchoice .= ''.&mt('status').'- '.$status_types{$statusfilter}; @@ -637,7 +637,7 @@ END } } if ($dischash{$toggkey}) { - my $storebutton = &mt('Store read/unread changes'); + my $storebutton = &mt('Save read/unread changes'); $discussion.=''. ''."\n". ''; + $discussion.= &send_feedback_link($ressymb,$target); } } if ($outputtarget ne 'tex') { $discussion.= &send_message_link($ressymb); } - $discussion.=''; + $discussion.=''; } return $discussion; } @@ -763,7 +762,7 @@ sub send_feedback_link { sub send_message_link { my ($ressymb) = @_; - my $output = ''. + my $output = ''. ' '.&mt('Sorting/Filtering options').'  '; + $discussion .='">'.&mt('Sorting/Filtering options').''.(' ' x2); } else { $discussion .= ''; } @@ -901,6 +900,9 @@ sub build_posting_display { $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); + my $see_anonymous = + &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')); + if ((@{$grouppick} == 0) || (grep(/^all$/,@{$grouppick}))) { $skip_group_check = 1; } @@ -1001,18 +1003,20 @@ sub build_posting_display { @{$$subjectsort{$subject}} = ("$idx"); } } - if ((!$contrib{$idx.':anonymous'}) || (&Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')))) { + if (!$contrib{$idx.':anonymous'} || $see_anonymous) { $sender=&Apache::loncommon::aboutmewrapper( $plainname, $contrib{$idx.':sendername'}, $contrib{$idx.':senderdomain'}).' ('. - $contrib{$idx.':sendername'}.' at '. + $contrib{$idx.':sendername'}.':'. $contrib{$idx.':senderdomain'}.')'; if ($contrib{$idx.':anonymous'}) { $sender.=' ['.$$anonhash{$key}.'] '. $screenname; } - + if ($see_anonymous) { + $sender.=&Apache::loncommon::student_image_tag($contrib{$idx.':senderdomain'},$contrib{$idx.':sendername'}); + } # Set up for sorting by domain, then username unless (defined($$usernamesort{$contrib{$idx.':senderdomain'}})) { %{$$usernamesort{$contrib{$idx.':senderdomain'}}} = (); @@ -1236,7 +1240,7 @@ sub build_posting_display { $$newitem{$idx} = 1; $$discussionitems[$idx] .= '

- '; + '; } else { $$newitem{$idx} = 0; $$discussionitems[$idx] .= ' @@ -1468,7 +1472,7 @@ sub replicate_attachments { } sub mail_screen { - my ($r,$feedurl,$options) = @_; + my ($r,$feedurl,$options,$caller_symb,$attachmaxtext) = @_; if (exists($env{'form.origpage'})) { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog','group','ref']); } @@ -1478,10 +1482,9 @@ sub mail_screen { 'myqu' => 'My question/comment/feedback:', 'title' => 'Title', 'reta' => 'Retained attachments', - 'atta' => 'Attachment (128 KB max size)', - ); - my $title=&Apache::lonnet::gettitle($feedurl); - if (!$title) { $title = $feedurl; } + 'atta' => 'Attachment', + ); + my $restitle = &get_resource_title($caller_symb,$feedurl); my $quote=''; my $subject = ''; my $comment = ''; @@ -1615,7 +1618,7 @@ END $comment = &unescape($env{'form.comment'}); &process_attachments(\@currnewattach,\@currdelold,\@keepold); } - my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(); + my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(undef,undef,1); my $send=&mt('Send'); my $alert = &mt('Please select a feedback type.'); my $js= <print(<$title +

$restitle

$prevtag @@ -1718,7 +1721,7 @@ END } } else { $r->print(< +$lt{'atta'} $attachmaxtext:

END } @@ -1799,7 +1802,7 @@ sub print_display_options { 'unread' => 'New posts only', 'unmark' => 'Posts not marked read', 'ondisp' => 'Once displayed', - 'onmark' => 'Once marked not NEW ', + 'onmark' => 'Once marked not NEW', 'toggon' => 'Shown', 'toggoff' => 'Not shown', 'disa' => 'Posts displayed?', @@ -1957,6 +1960,7 @@ END
END + my $save = &mt('Save Changes'); $r->print(&Apache::loncommon::end_data_table_row()); $r->print(&Apache::loncommon::end_data_table()); $r->print(< - + END if (exists($env{'form.group'})) { $r->print(''); @@ -2056,7 +2060,7 @@ sub print_sortfilter_options { 'spgr' => 'Specific groups', 'psub' => 'Pick specific users (by name)', 'shal' => 'Show a list of current posters', - 'stor' => 'Store changes', + 'stor' => 'Save changes', ); my %sort_types = (); @@ -2148,7 +2152,7 @@ $start_page @@ -2387,7 +2391,7 @@ ENDFAILREDIR } sub redirect_back { - my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$blog,$status,$previous,$sort,$rolefilter,$statusfilter,$sectionpick,$grouppick,$numpicks,$group) = @_; + my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$blog,$status,$previous,$sort,$rolefilter,$statusfilter,$sectionpick,$grouppick,$numpicks,$group,$toolarge) = @_; my $sorttag = ''; my $roletag = ''; my $statustag = ''; @@ -2501,6 +2505,7 @@ $start_page $typestyle Sent $sendsomething message(s), and $sendposts post(s). $blog +$toolarge $status $prevtag @@ -2560,26 +2565,31 @@ sub screen_header { '

'; } + my %optionhash=(); + foreach my $type ('question','comment','policy') { + $optionhash{$type}=$env{'course.'.$env{'request.course.id'}.'.'.$type.'.email.text'}; + } if (&feedback_available(1)) { $msgoptions.= '

'; + ($optionhash{'question'}?$optionhash{'question'}:&mt('Question about resource content')).'

'; } if (&feedback_available(0,1)) { $msgoptions.= '

'; } if (&feedback_available(0,0,1)) { $msgoptions.= '

'; } } if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) { - if (&discussion_open(undef,$symb) && + my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('boards'); + if (!$blocked && &discussion_open(undef,$symb) && &Apache::lonnet::allowed('pch', $env{'request.course.id'}. ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { @@ -2589,10 +2599,10 @@ sub screen_header { &mt('Anonymous contribution to course discussion of resource'). ' ('.&mt('name only visible to course faculty').') '. ''.&mt('Change Screenname').''; - } - my $blockblog = &Apache::loncommon::blocking_status('blogs'); - if (!$blockblog) { - $discussoptions.= &add_blog_checkbox(); + my $blockblog = &Apache::loncommon::blocking_status('blogs'); + if (!$blockblog) { + $discussoptions.= &add_blog_checkbox(); + } } } if ($msgoptions) { $msgoptions='

'.&mt('Sending Messages').'

'.$msgoptions; } @@ -2641,7 +2651,7 @@ sub clear_out_html { } sub assemble_email { - my ($feedurl,$message,$prevattempts,$usersaw,$useranswer)=@_; + my ($message,$prevattempts,$usersaw,$useranswer)=@_; my %lt = &Apache::lonlocal::texthash( 'prev' => 'Previous attempts of student (if applicable)', 'orig' => 'Original screen output (if applicable)', @@ -2662,136 +2672,53 @@ ENDCITE return ($email,$citations); } -sub secapply { - my $rec=shift; - my $defaultflag=shift; - $rec=~s/\s+//g; - $rec=~s/\@/\:/g; - my ($adr,$sections)=($rec=~/^([^\(]+)\(([^\)]+)\)/); - if ($sections) { - foreach my $sec (split(/\;/,$sections)) { - if (($sec eq $env{'request.course.sec'}) || - ($defaultflag && ($sec eq '*'))) { - return $adr; - } - } - } else { - return $rec; - } - return ''; -} - -=pod - -=over 4 - -=item * - -decide_receiver($feedurl,$author,$question,$course,$policy,$defaultflag); - -Arguments - $feedurl - /res/ url of resource (only need if $author is true) - $author,$question,$course,$policy - all true/false parameters - if true will attempt to find the addresses of user that should receive - this type of feedback (author - feedback to author of resource $feedurl, - $question 'Resource Content Questions', $course 'Course Content Question', - $policy 'Course Policy') - (Additionally it also checks $env for whether the corresponding form. - element exists, for ease of use in a html response context) - - $defaultflag - (internal should be left blank) if true gather addresses - that aren't for a section even if I have a section - (used for reccursion internally, first we look for - addresses for our specific section then we recurse - and look for non section addresses) - -Returns - $typestyle - string of html text, describing what addresses were found - %to - a hash, which keys are addresses of users to send messages to - the keys will look like name:domain - -=cut - -sub decide_receiver { - my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_; - my $typestyle=''; - my %to=(); - if ($env{'form.discuss'} eq 'author' ||$author) { - $typestyle.='Submitting as Author Feedback
'; - $feedurl=~ m{^/res/($LONCAPA::domain_re)/($LONCAPA::username_re)/}; - $to{$2.':'.$1}=1; - } - if ($env{'form.discuss'} eq 'question' ||$question) { - $typestyle.=&mt('Submitting as Question').'
'; - foreach my $item (split(/\,/, - $env{'course.'.$env{'request.course.id'}.'.question.email'}) - ) { - my $rec=&secapply($item,$defaultflag); - if ($rec) { $to{$rec}=1; } - } - } - if ($env{'form.discuss'} eq 'course' ||$course) { - $typestyle.=&mt('Submitting as Comment').'
'; - foreach my $item (split(/\,/, - $env{'course.'.$env{'request.course.id'}.'.comment.email'}) - ) { - my $rec=&secapply($item,$defaultflag); - if ($rec) { $to{$rec}=1; } - } - } - if ($env{'form.discuss'} eq 'policy' ||$policy) { - $typestyle.=&mt('Submitting as Policy Feedback').'
'; - foreach my $item (split(/\,/, - $env{'course.'.$env{'request.course.id'}.'.policy.email'}) - ) { - my $rec=&secapply($item,$defaultflag); - if ($rec) { $to{$rec}=1; } - } - } - if ((scalar(%to) eq '0') && (!$defaultflag)) { - ($typestyle,%to)= - &decide_receiver($feedurl,$author,$question,$course,$policy,1); - } - return ($typestyle,%to); -} sub feedback_available { my ($question,$course,$policy)=@_; - my ($typestyle,%to)=&decide_receiver('',0,$question,$course,$policy); + my ($typestyle,%to)=&Apache::lonmsg::decide_receiver('',0,$question, + $course,$policy); return scalar(%to); } sub send_msg { - my ($title,$feedurl,$email,$citations,$attachmenturl,%to)=@_; - my $status=''; - my $sendsomething=0; - if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; } - unless ($title=~/\w/) { $title=&mt('Feedback'); } - foreach my $key (keys(%to)) { - if ($key) { - my $declutter=&Apache::lonnet::declutter($feedurl); - unless (&Apache::lonmsg::user_normal_msg(split(/\:/,$key), - $title.' ['.$declutter.']',$email,$citations,$feedurl, - $attachmenturl)=~/ok/) { - $status.='
'.&mt('Error sending message to').' '.$key.'
'; - } else { - $sendsomething++; - } + my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,%to)=@_; + my $status=''; + my $sendsomething=0; + my $restitle = &get_resource_title($symb,$feedurl); + if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; } + unless ($title=~/\w/) { $title=&mt('Feedback'); } + foreach my $key (keys(%to)) { + if ($key) { + my ($user,$domain) = split(/\:/,$key,2); + if (!defined($user)) { + $status.='
'.&mt('Error sending message to [_1], no user specified.',$key); + } elsif (!defined($domain)) { + $status.='
'.&mt('Error sending message to [_1], no domain specified.',$key); + } else { + unless (&Apache::lonmsg::user_normal_msg($user,$domain, + $title.' ['.$restitle.']',$email,$citations,$feedurl, + $attachmenturl,undef,undef,$symb,$restitle)=~/ok/) { + $status.='
'.&mt('Error sending message to').' '.$key.'
'; + } else { + $sendsomething++; + } + } + } } - } + my %record=&Apache::lonnet::restore('_feedback'); my ($temp)=keys(%record); unless ($temp=~/^error\:/) { - my %newrecord=(); - $newrecord{'resource'}=$feedurl; - $newrecord{'subnumber'}=$record{'subnumber'}+1; - unless (&Apache::lonnet::cstore(\%newrecord,'_feedback') eq 'ok') { - $status.='
'.&mt('Not registered').'
'; - } + my %newrecord=(); + $newrecord{'resource'}=$feedurl; + $newrecord{'subnumber'}=$record{'subnumber'}+1; + unless (&Apache::lonnet::cstore(\%newrecord,'_feedback') eq 'ok') { + $status.='
'.&mt('Not registered').'
'; + } } - - return ($status,$sendsomething); + + return ($status,$sendsomething); } sub adddiscuss { @@ -3006,7 +2933,8 @@ ENDPREVIEW } sub modify_attachments { - my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_; + my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls, + $attachmaxtext,$toolarge)=@_; my %lt = &Apache::lonlocal::texthash( 'subj' => 'Subject', @@ -3014,7 +2942,7 @@ sub modify_attachments { 'chth' => 'Check the checkboxes for any you wish to remove.', 'thef' => 'The following attachments have been uploaded for inclusion with this posting.', 'adda' => 'Add a new attachment to this post.', - 'stch' => 'Store Changes', + 'stch' => 'Save Changes', ); my $js = < @@ -3048,10 +2976,12 @@ END $r->print(< -
NEW
'.&mt('NEW').'$lt{$disctogg}   - @@ -2160,13 +2164,13 @@ $start_page   - $section_sel   - $group_sel
+
+
- + + + + +
+ Subject: $subject

END if ($idx) { @@ -3077,9 +3007,15 @@ END $r->print("
"); } $r->print(< +
+ $lt{'adda'}
$attachmaxtext
@@ -3311,12 +3247,18 @@ function setblogvalue() { sub has_discussion { my $resourcesref = shift; my $navmap = Apache::lonnavmaps::navmap->new(); - my @allres=$navmap->retrieveResources(); - foreach my $resource (@allres) { - if ($resource->hasDiscussion()) { - my $ressymb = $resource->wrap_symb(); - push(@{$resourcesref}, $ressymb); + if (defined($navmap)) { + my @allres=$navmap->retrieveResources(); + foreach my $resource (@allres) { + if ($resource->hasDiscussion()) { + my $ressymb = $resource->wrap_symb(); + if (ref($resourcesref) eq 'ARRAY') { + push(@{$resourcesref}, $ressymb); + } + } } + } else { + &Apache::lonnet::logthis('Has discussion check failed - could not create navmap object.'); } return; } @@ -3362,6 +3304,10 @@ sub handler { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','groupick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export','sendmessageonly','group','ref']); my $group = $env{'form.group'}; + my %attachmax = ( + text => '(128 KB max size)', + num => 131072, + ); if ($env{'form.editdisc'}) { if (!(&editing_allowed($env{'form.editdisc'},$env{'form.group'}))) { my $symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0]; @@ -3632,7 +3578,7 @@ ENDREDIR my ($symb,$feedurl)=&get_feedurl_and_clean_symb($env{'form.symb'}); if ($env{'form.cmd'} eq 'threadedon') { &Apache::lonnet::put('environment',{'threadeddiscussion' => 'on'}); - &Apache::lonnet::appenv('environment.threadeddiscussion' => 'on'); + &Apache::lonnet::appenv({'environment.threadeddiscussion' => 'on'}); } else { &Apache::lonnet::del('environment',['threadeddiscussion']); &Apache::lonnet::delenv('environment\.threadeddiscussion'); @@ -3670,13 +3616,15 @@ ENDREDIR &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','addnewattach','delnewattach','timestamp','numoldver','idx','discuss','blog']); - my (@currnewattach,@currdelold,@keepold); + my (@currnewattach,@currdelold,@keepold,$toolarge); &process_attachments(\@currnewattach,\@currdelold,\@keepold); if (exists($env{'form.addnewattach.filename'})) { - unless (length($env{'form.addnewattach'})>131072) { + if (length($env{'form.addnewattach'})<=$attachmax{'num'}) { my $subdir = 'feedback/'.$env{'form.timestamp'}; my $newattachment=&Apache::lonnet::userfileupload('addnewattach',undef,$subdir); push(@currnewattach, $newattachment); + } else { + $toolarge = '

'.&mt('Attachment not included - exceeded permitted length').'

'; } } my $attachmenturls; @@ -3689,7 +3637,7 @@ ENDREDIR $attachmenturls = $contrib{$idx.':attachmenturl'}; } &modify_attachments($r,\@currnewattach,\@currdelold,$symb,$idx, - $attachmenturls); + $attachmenturls,$attachmax{'text'},$toolarge); return OK; } elsif ($env{'form.export'}) { &Apache::loncommon::content_type($r,'text/html'); @@ -3712,7 +3660,7 @@ ENDREDIR } else { # ------------------------------------------------------------- Normal feedback my $feedurl=$env{'form.postdata'}; - $feedurl=~s/^http\:\/\///; + $feedurl=~s/^https?\:\/\///; $feedurl=~s/^$ENV{'SERVER_NAME'}//; $feedurl=~s/^$ENV{'HTTP_HOST'}//; $feedurl=~s/\?.+$//; @@ -3720,12 +3668,8 @@ ENDREDIR my $symb; if ($env{'form.replydisc'}) { $symb=(split(/\:\:\:/,$env{'form.replydisc'}))[0]; - my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); - $feedurl=&Apache::lonnet::clutter($url); } elsif ($env{'form.editdisc'}) { $symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0]; - my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); - $feedurl=&Apache::lonnet::clutter($url); } elsif ($env{'form.origpage'}) { $symb=""; } else { @@ -3733,18 +3677,18 @@ ENDREDIR } unless ($symb) { $symb=$env{'form.symb'}; - if ($symb) { - my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb); - $feedurl=&Apache::lonnet::clutter($url); - } } - &Apache::lonenc::check_decrypt(\$symb); + if (defined($symb)) { + ($symb,$feedurl)=&get_feedurl_and_clean_symb($symb); + } else { + # backward compatibility (bulletin boards used to be 'wrapped') + &Apache::lonenc::check_decrypt(\$feedurl); + &dewrapper(\$feedurl); + } my $goahead=1; if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form|task)$/) { unless ($symb) { $goahead=0; } } - # backward compatibility (bulletin boards used to be 'wrapped') - &dewrapper(\$feedurl); if (!$goahead) { # Ambiguous Problem Resource $r->internal_redirect('/adm/ambiguous'); @@ -3782,7 +3726,7 @@ ENDREDIR } my $options=&screen_header($feedurl,$symb); if ($options) { - &mail_screen($r,$feedurl,$options); + &mail_screen($r,$feedurl,$options,$symb,$attachmax{'text'}); } else { &fail_redirect($r,$feedurl); } @@ -3795,16 +3739,20 @@ ENDREDIR $env{'request.course.id'}); # Get output from resource + &Apache::lonenc::check_encrypt(\$feedurl); my $usersaw=&resource_output($feedurl); # Get resource answer (need to allow student to view grades for this to work) - &Apache::lonnet::appenv(('allowed.vgr'=>'F')); - my $useranswer=&Apache::loncommon::get_student_answers( - $symb,$env{'user.name'},$env{'user.domain'}, - $env{'request.course.id'}); + &Apache::lonnet::appenv({'allowed.vgr'=>'F'}); + my $usersymb = &Apache::lonenc::check_encrypt($symb); + my $useranswer= + &Apache::loncommon::get_student_answers( + $usersymb,$env{'user.name'},$env{'user.domain'}, + $env{'request.course.id'}); &Apache::lonnet::delenv('allowed.vgr'); # Get attachments, if any, and not too large my $attachmenturl=''; + my $toolarge=''; if (($env{'form.origpage'}) || ($env{'form.editdisc'}) || ($env{'form.replydisc'})) { my ($symb,$idx); @@ -3823,25 +3771,29 @@ ENDREDIR $symb=~s|(bulletin___\d+___)adm/wrapper/|$1|; $attachmenturl=&construct_attachmenturl(\@currnewattach,\@keepold,$symb,$idx); } elsif ($env{'form.attachment.filename'}) { - unless (length($env{'form.attachment'})>131072) { - $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback'); - } + if (length($env{'form.attachment'})<=$attachmax{'num'}) { + my $now = time; + my $subdir = 'feedback/'.$now; + $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,$subdir); + } else { + $toolarge = '

'.&mt('Attachment not included - exceeded permitted length').'

'; + } } # Filter HTML out of message (could be nasty) my $message=&clear_out_html($env{'form.comment'}); # Assemble email - my ($email,$citations)=&assemble_email($feedurl,$message,$prevattempts, + my ($email,$citations)=&assemble_email($message,$prevattempts, $usersaw,$useranswer); # Who gets this? - my ($typestyle,%to) = &decide_receiver($feedurl); + my ($typestyle,%to) = &Apache::lonmsg::decide_receiver($feedurl); # Actually send mail my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}, undef,1), $feedurl,$email,$citations, - $attachmenturl,%to); + $attachmenturl,$usersymb,%to); # Discussion? Store that. my $numpost=0; @@ -3868,7 +3820,7 @@ ENDREDIR } # Receipt screen and redirect back to where came from - &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},undef,undef,undef,undef,undef,undef,$group); + &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},undef,undef,undef,undef,undef,undef,$group,$toolarge); } return OK; } @@ -3984,5 +3936,32 @@ sub group_args { return $extra_args; } +sub get_resource_title { + my ($symb,$feedurl) = @_; + my ($restitle,$plainurl); + if (defined($symb)) { + my $plain_symb = &Apache::lonenc::check_decrypt($symb); + $restitle = &Apache::lonnet::gettitle($plain_symb); + } + if (defined($feedurl)) { + $plainurl = &Apache::lonenc::check_decrypt($feedurl); + } + if (!defined($restitle)) { + if (defined($feedurl)) { + $restitle = &Apache::lonnet::gettitle($plainurl); + } + } + if ($plainurl ne $feedurl) { + my ($plain_filename) = ($plainurl =~ m-/([^/]+)$-); + if ($plain_filename eq $restitle) { + $restitle = &mt('Untitled resource'); + } + } + if ($restitle eq '') { + $restitle = &mt('Untitled resource'); + } + return $restitle; +} + 1; __END__