--- loncom/interface/lonfeedback.pm 2006/03/06 19:21:22 1.183 +++ loncom/interface/lonfeedback.pm 2006/03/19 21:43:21 1.186 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.183 2006/03/06 19:21:22 www Exp $ +# $Id: lonfeedback.pm,v 1.186 2006/03/19 21:43:21 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1303,8 +1303,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 +1441,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 +1601,8 @@ END } $r->print(&generate_preview_button(). &Apache::lonhtmlcommon::htmlareaselectactive('comment'). - ''); + &Apache::loncommon::end_page()); + } sub print_display_options { @@ -1978,11 +1978,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 +2010,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 +2041,8 @@ END } } } + + my $end_page = &Apache::loncommon::end_page(); $r->print(< @@ -2058,8 +2053,7 @@ END - - +$end_page END } @@ -2067,7 +2061,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 +2123,15 @@ 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 +2205,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). @@ -2239,8 +2229,7 @@ $sectag $userpicktag
Continue - - +$end_page ENDREDIR } @@ -2314,8 +2303,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) { @@ -2541,7 +2530,6 @@ sub adddiscuss { } if (($symb) && ($email)) { if ($env{'form.editdisc'}) { - my %newcontrib = (); $contrib{'ip'}=$ENV{'REMOTE_ADDR'}; $contrib{'host'}=$Apache::lonnet::perlvar{'lonHostID'}; $contrib{'timestamp'} = time; @@ -2584,10 +2572,6 @@ sub adddiscuss { } } $contrib{'history'} .= $oldcontrib{$oldidx.':timestamp'}; - foreach (keys %contrib) { - my $key = $oldidx.':'.&Apache::lonnet::escape($oldsymb).':'.$_; - $newcontrib{$key} = $contrib{$_}; - } my $put_reply = &Apache::lonnet::putstore($env{'request.course.id'}, $oldsymb,$oldidx,\%contrib, $env{'course.'.$env{'request.course.id'}.'.domain'}, @@ -3130,22 +3114,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'}) { @@ -3498,30 +3481,25 @@ sub editing_allowed { my $cid = $env{'request.course.id'}; my $role = (split(/\./,$env{'request.role'}))[0]; my $section = $env{'request.course.sec'}; - my $allow_editing_config = $env{'course.'.$env{'request.course.id'}. - '.allow_discussion_post_editing'}; + my $allow_editing_config = + $env{'course.'.$cid.'.allow_discussion_post_editing'}; if ($allow_editing_config =~ m/^\s*yes\s*$/i) { $can_edit = 1; } else { - my @editor_roles = split(/,/,$allow_editing_config); - if (@editor_roles > 0) { - foreach my $editor (@editor_roles) { - my ($editor_role,$editor_sec) = split(/:/,$editor); - if ($editor_role eq $role) { - if (defined($editor_sec)) { - if (defined($section)) { - if ($editor_sec eq $section) { - $can_edit = 1; - last; - } - } - } else { - $can_edit = 1; - last; - } - } - } - } + foreach my $editor (split(/,/,$allow_editing_config)) { + my ($editor_role,$editor_sec) = split(/:/,$editor); + if ($editor_role eq $role + && defined($editor_sec) + && defined($section) + && $editor_sec eq $section) { + $can_edit = 1; + last; + } + if ($editor_role eq $role + && !defined($editor_sec)) { + $can_edit = 1; + } + } } return $can_edit; }