--- loncom/interface/lonwhatsnew.pm 2005/04/05 22:49:17 1.1 +++ loncom/interface/lonwhatsnew.pm 2005/04/07 04:22:03 1.4 @@ -1,13 +1,40 @@ +# +# $Id: lonwhatsnew.pm,v 1.4 2005/04/07 04:22:03 albertel Exp $ +# +# Copyright Michigan State University Board of Trustees +# +# This file is part of the LearningOnline Network with CAPA (LON-CAPA). +# +# LON-CAPA is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LON-CAPA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LON-CAPA; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# /home/httpd/html/adm/gpl.txt +# +# http://www.lon-capa.org/ +# + + package Apache::lonwhatsnew; use strict; use lib qw(/home/httpd/lib/perl); use Apache::lonnet; -use Apache::loncommon; -use Apache::lonhtmlcommon; +use Apache::loncommon(); +use Apache::lonhtmlcommon(); use Apache::lonlocal; -use Apache::loncoursedata; -use Apache::lonnavmaps; +use Apache::loncoursedata(); +use Apache::lonnavmaps(); use Apache::Constants qw(:common :http); use Time::Local; @@ -150,9 +177,10 @@ sub display_nav_box { #------------------------------- sub display_header{ + my $html=&Apache::lonxml::xmlbegin(); my $bodytag=&Apache::loncommon::bodytag('Course Action Items'); return(< +$html Course Action Items @@ -223,13 +251,8 @@ END my $rowNum = 0; foreach my $ressymb (@newdiscussions) { my $forum_title = $unread{$ressymb}{'title'}; - my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ressymb); - my $feedurl = &Apache::lonnet::clutter($url); -# backward compatibility (bulletin boards used to be 'wrapped') - if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) { - $feedurl=~s|^/adm/wrapper||; - } - my $unreadnum = keys %{$unread{$ressymb}}; + my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb); + my $unreadnum = keys(%{$unread{$ressymb}}); $unreadnum = $unreadnum - 2; if ($unreadnum > 0) { if ($rowNum %2 == 1) { @@ -389,10 +412,10 @@ sub getitems { my @discussions = (); my ($classlist,$keylist) = &Apache::loncoursedata::get_classlist(); - foreach (keys %lastread) { - my $key = $_; - $key =~ s/_lastread$//; - $lastreadtime{$key} = $lastread{$_}; + foreach my $key (keys(%lastread)) { + my $newkey = $key; + $newkey =~ s/_lastread$//; + $lastreadtime{$newkey} = $lastread{$key}; } foreach my $resource (@allres) { my $result = ''; @@ -403,10 +426,8 @@ sub getitems { my $title = $resource->compTitle(); my $ressymb = $symb; if ($ressymb =~ m-(___adm/\w+/\w+)/(\d+)/bulletinboard$-) { - $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard'; - unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { - $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper/|; - } + $ressymb = &Apache::lonfeedback::wrap_symb('bulletin___'.$2.$1.'/'. + $2.'/bulletinboard'); } # Check for unread discussion postings @@ -442,7 +463,7 @@ sub getitems { my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); my ($partlist,$handgrade,$responseType) = &Apache::grades::response_type($url,$symb); foreach my $student (keys(%$classlist)) { - my ($uname,$udom) = split/:/,$student; + my ($uname,$udom) = split(/:/,$student); my %status=&Apache::grades::student_gradeStatus($url,$symb,$udom,$uname,$partlist); my $submitted = 0; my $graded = 0; @@ -483,11 +504,10 @@ sub getmail { my ($newmsgs,$critmsgs) = @_; # Check for unread mail in course my $msgcount = 0; - my @msgids = sort split(/\&/,&Apache::lonnet::reply - ('keys:'.$ENV{'user.domain'}.':'. - $ENV{'user.name'}.':nohist_email', - $ENV{'user.home'})); - foreach my $msgid (@msgids) { + + my @messages = &Apache::lonnet::getkeys('nohist_email'); + foreach my $message (@messages) { + my $msgid=&Apache::lonnet::escape($message); my ($sendtime,$shortsubj,$fromname,$fromdom,$fromcid,$status)= &Apache::lonmsg::unpackmsgid($msgid); if ($fromcid eq $ENV{'request.course.id'}) { @@ -512,7 +532,7 @@ sub getmail { my %what=&Apache::lonnet::dump('critical'); my $result = ''; my $critmsgcount = 0; - foreach my $msgid (sort keys %what) { + foreach my $msgid (sort(keys(%what))) { my ($sendtime,$shortsubj,$fromname,$fromdom,$fromcid,$status)= &Apache::lonmsg::unpackmsgid($_); if ($fromcid eq $ENV{'request.course.id'}) {