--- loncom/interface/lonfeedback.pm 2006/03/15 19:41:26 1.184 +++ loncom/interface/lonfeedback.pm 2006/04/10 21:55:48 1.190 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.184 2006/03/15 19:41:26 albertel Exp $ +# $Id: lonfeedback.pm,v 1.190 2006/04/10 21:55:48 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -744,17 +744,22 @@ ENDDISCUSS } } } else { + $discussion.='
'; if (&discussion_open($status) && &Apache::lonnet::allowed('pch', $env{'request.course.id'}. ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { if ($outputtarget ne 'tex') { - $discussion.='
'. ''. - &mt('Post Discussion').'
'; - } + &mt('Post Discussion').'
'; + } } + $discussion.=''. + &mt('Send Message').'
'; } return $discussion; } @@ -1253,7 +1258,7 @@ END } } if ($type eq 'allversions') { - $discussion.=(''); + $discussion.=''; return $discussion; } else { return; @@ -1303,8 +1308,7 @@ sub mail_screen { if (exists($env{'form.origpage'})) { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog']); } - my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion', - '','onLoad="window.focus();setposttype();"'); + my $title=&Apache::lonnet::gettitle($feedurl); if (!$title) { $title = $feedurl; } my $quote=''; @@ -1442,15 +1446,8 @@ END &process_attachments(\@currnewattach,\@currdelold,\@keepold); } my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(); - my $htmlheader=&Apache::lonhtmlcommon::htmlareaheaders(); my $send=&mt('Send'); - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -The LearningOnline Network with CAPA - -$htmlheader + my $js= < // - -$bodytag +END + + my %onload = ('onload' => 'window.focus();setposttype();'); + my $start_page= + &Apache::loncommon::start_page('Resource Feedback and Discussion',$js, + {'add_entries' => \%onload}); + + $r->print(<$title
@@ -1602,7 +1606,8 @@ END } $r->print(&generate_preview_button(). &Apache::lonhtmlcommon::htmlareaselectactive('comment'). - ''); + &Apache::loncommon::end_page()); + } sub print_display_options { @@ -1613,11 +1618,8 @@ sub print_display_options { my $function = &Apache::loncommon::get_users_function(); my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', $env{'user.domain'}); - my $bodytag=&Apache::loncommon::bodytag('Discussion options', - '',''); my %lt = &Apache::lonlocal::texthash( - 'dido' => 'Discussion display options', 'pref' => 'Display Preference', 'curr' => 'Current setting ', 'actn' => 'Action', @@ -1675,13 +1677,9 @@ sub print_display_options { $currtogg = $lt{'toggon'}; $disctogg = 'toggon'; } - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -$lt{'dido'} - - - -$bodytag - +END + + + my $start_page = + &Apache::loncommon::start_page('Discussion display options',$js); + my $end_page = + &Apache::loncommon::end_page(); + $r->print(< $lt{'sdpf'}
$lt{'prca'}
  1. $lt{'whpo'}
  2. $lt{'unwh'}
  3. $lt{'wipa'}

@@ -1800,8 +1804,7 @@ $lt{'sdpf'}
$lt{'prca'}
  1. $l

    - - +$end_page END return; } @@ -1838,10 +1841,7 @@ sub print_sortfilter_options { my $function = &Apache::loncommon::get_users_function(); my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', $env{'user.domain'}); - my $bodytag=&Apache::loncommon::bodytag('Discussion options', - '',''); my %lt = &Apache::lonlocal::texthash( - 'diso' => 'Discussion sorting and filtering options', 'diop' => 'Display Options', 'curr' => 'Current setting ', 'actn' => 'Action', @@ -1858,12 +1858,8 @@ sub print_sortfilter_options { my %role_types = (); my %status_types = (); &sort_filter_names(\%sort_types,\%role_types,\%status_types); - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -$lt{'diso'} - + + my $js = < function verifyFilter() { var rolenum = 0 @@ -1888,9 +1884,16 @@ function verifyFilter() { document.modifyshown.submit(); } - -$bodytag -
    +END + + my $start_page= + &Apache::loncommon::start_page('Discussion options',$js); + my $end_page= + &Apache::loncommon::end_page(); + + $r->print(< $lt{'diso'}
    $lt{'prca'}

@@ -1955,8 +1958,7 @@ $bodytag

- - +$end_page END } @@ -1978,11 +1980,7 @@ sub print_showposters { $env{'course.'.$env{'request.course.id'}.'.num'}); my %namesort = (); my %postcounts = (); - my %lt=&Apache::lonlocal::texthash( - 'diso' => 'Discussion filtering options', - ); - my $bodytag=&Apache::loncommon::bodytag('Discussion options', - '',''); + if ($contrib{'version'}) { for (my $idx=1;$idx<=$contrib{'version'};$idx++) { my $hidden=($contrib{'hidden'}=~/\.$idx\./); @@ -2014,14 +2012,11 @@ sub print_showposters { } } } - my $html=&Apache::lonxml::xmlbegin(); + + my $start_page = &Apache::loncommon::start_page('Discussion options'); + $r->print(< -$lt{'diso'} - - -$bodytag +$start_page
@@ -2048,6 +2043,8 @@ END } } } + + my $end_page = &Apache::loncommon::end_page(); $r->print(< @@ -2058,8 +2055,7 @@ END - - +$end_page END } @@ -2067,7 +2063,8 @@ sub get_post_versions { my ($versions,$incoming,$htmldecode,$numver) = @_; if ($incoming =~ /^/) { my $p = HTML::LCParser->new(\$incoming); - my $done = 0; + my $done = 0; + while ( (my $token = $p->get_tag("version")) && (!$done)) { my $num = $token->[1]{num}; my $text = $p->get_text("/version"); @@ -2128,21 +2125,14 @@ sub fail_redirect { my ($r,$feedurl) = @_; if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); - my $html=&Apache::lonxml::xmlbegin(); - $r->print (< -Feedback not sent - - - - + $r->print(&Apache::loncommon::start_page('Feedback not sent',undef, + {'redirect' => [2,$feedurl], + 'only_body' => 1,})); + $r->print(< Sorry, no recipients ... -
Continue - - ENDFAILREDIR + $r->print(&Apache::loncommon::end_page()); } sub redirect_back { @@ -2216,15 +2206,16 @@ sub redirect_back { } $feedurl=&Apache::lonenc::check_encrypt($feedurl); my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); - my $html=&Apache::lonxml::xmlbegin(); - $r->print (< -Feedback sent - - - - + my %onload = ('onload' => "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }"); + my $start_page= + &Apache::loncommon::start_page('New posts marked as read',undef, + {'redirect' => [2,$feedurl], + 'only_body' => 1, + 'add_entries' => \%onload}); + my $end_page = &Apache::loncommon::end_page(); + + $r->print(< $typestyle Sent $sendsomething message(s), and $sendposts post(s). @@ -2238,28 +2229,26 @@ $roletag $sectag $userpicktag -
Continue - - +$end_page ENDREDIR } sub no_redirect_back { my ($r,$feedurl) = @_; my $nofeed=&mt('Sorry, no feedback possible on this resource ...'); - my $continue=&mt('Continue'); - my $html=&Apache::lonxml::xmlbegin(); - $r->print (< -Feedback not sent - -ENDNOREDIR - - if ($feedurl!~/^\/adm\/feedback/) { - $r->print(''); - } + + my %body_options = ('only_body' => 1, + 'add_entries' => {'onload' => "if (window.name!='loncapaclient') { self.window.close(); }"}); + + if ($feedurl !~ m{^/adm/feedback}) { + $body_options{'rediect'} = [2,$feedurl]; + } + my $start_page= + &Apache::loncommon::start_page('Feedback not sent',undef, + \%body_options); + + my $end_page = &Apache::loncommon::end_page(); + $feedurl=&Apache::lonenc::check_encrypt($feedurl); my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); $r->print (< $nofeed -
$continue - - +
+$end_page ENDNOREDIRTWO } @@ -2301,7 +2289,7 @@ sub screen_header { '

'; } } - if ($env{'request.course.id'}) { + if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) { if (&discussion_open(undef,$symb) && &Apache::lonnet::allowed('pch', $env{'request.course.id'}. @@ -2314,8 +2302,8 @@ sub screen_header { ' ('.&mt('name only visible to course faculty').') '. ''.&mt('Change Screenname').''; } - #$discussoptions.='
'; + $discussoptions.='
'; } if ($msgoptions) { $msgoptions='

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

'.$msgoptions; } if ($discussoptions) { @@ -2618,7 +2606,7 @@ sub adddiscuss { # ----------------------------------------------------------- Preview function sub show_preview { - my $r=shift; + my ($r) = @_; &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; my $message=&clear_out_html($env{'form.comment'}); @@ -2628,11 +2616,15 @@ sub show_preview { my $subject=&clear_out_html($env{'form.subject'}); $subject=~s/\n/\
/g; $subject=&Apache::lontexconvert::msgtexconverted($subject); - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.''. - '
'. + my $start_page= + &Apache::loncommon::start_page('Preview',undef, + {'only_body' => 1,}); + + my $end_page = &Apache::loncommon::end_page(); + + $r->print($start_page.'
'. 'Subject: '.$subject.'

'. - $message.'
'); + $message.'
'.$end_page); } @@ -2680,8 +2672,7 @@ sub modify_attachments { $subject=&Apache::lontexconvert::msgtexconverted($subject); my $timestamp=$env{'form.timestamp'}; my $numoldver=$env{'form.numoldver'}; - my $bodytag=&Apache::loncommon::bodytag('Discussion Post Attachments', - '',''); + my $msg = ''; my %attachments = (); my %currattach = (); @@ -2689,19 +2680,21 @@ sub modify_attachments { &extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold); } &Apache::lonenc::check_encrypt(\$symb); - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -Managing Attachments - - -$bodytag +END + + my $start_page = + &Apache::loncommon::start_page('Discussion Post Attachments',$js); + my $end_page = + &Apache::loncommon::end_page(); + + $r->print(< @@ -2754,8 +2747,7 @@ END $r->print(< - - +$end_page END return; } @@ -2988,7 +2980,7 @@ sub handler { # --------------------------- Get query string for limited number of parameters &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','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export']); + ['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','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export','sendmessageonly']); if ($env{'form.editdisc'}) { if (!(&editing_allowed())) { my $symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0]; @@ -3026,17 +3018,11 @@ sub handler { } if ($env{'form.allversions'}) { &Apache::loncommon::content_type($r,'text/html'); + &Apache::loncommon::no_cache($r); $r->send_http_header; - my $html=&Apache::lonxml::xmlbegin(); - my $bodytag=&Apache::loncommon::bodytag('Discussion Post Versions'); - $r->print(< -Post Versions - - -$bodytag -END + + $r->print(&Apache::loncommon::start_page('Discussion Post Versions')); + my $crs='/'.$env{'request.course.id'}; if ($env{'request.course.sec'}) { $crs.='_'.$env{'request.course.sec'}; @@ -3057,6 +3043,7 @@ END $env{'course.'.$env{'request.course.id'}.'.num'}); $r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname)); } + $r->print(&Apache::loncommon::end_page()); return OK; } if ($env{'form.posterlist'}) { @@ -3125,22 +3112,21 @@ END &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); - my $html=&Apache::lonxml::xmlbegin(); + my %onload = ('onload' => "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }"); + my $start_page= + &Apache::loncommon::start_page('New posts marked as read',undef, + {'redirect' => [2,$feedurl], + 'only_body' => 1, + 'add_entries' => \%onload}); + my $end_page = &Apache::loncommon::end_page(); $r->print (< -New posts marked as read - - - - +$start_page $textline
-
Continue - - +
+$end_page ENDREDIR return OK; } elsif ($env{'form.modifydisp'}) { @@ -3299,8 +3285,11 @@ ENDREDIR $status=$Apache::inputtags::status[-1]; } my $discussion = &list_discussion($mode,$status,$symb); - my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion'); - $r->print($bodytag.$discussion); + my $start_page = + &Apache::loncommon::start_page('Resource Feedback and Discussion'); + my $end_page = + &Apache::loncommon::end_page(); + $r->print($start_page.$discussion.$end_page); return OK; } else { # ------------------------------------------------------------- Normal feedback