# # $Id: lonwhatsnew.pm,v 1.38.2.2 2005/12/22 22:39:49 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::lonlocal; use Apache::loncoursedata(); use Apache::lonnavmaps(); use Apache::lonuserstate; use Apache::Constants qw(:common :http); use Time::Local; use GDBM_File; #---------------------------- # handler # #---------------------------- sub handler { my $r = shift; if ($r->header_only) { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK; } &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['command']); my $command = $env{'form.command'}; &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; if (! (($env{'request.course.fn'}) && (&Apache::lonnet::allowed('bre',$env{'request.course.id'})))) { # Not in a course, or not allowed to view action items $env{'user.error.msg'}="/adm/whatsnew:bre:0:0:Cannot display what's new screen"; return HTTP_NOT_ACCEPTABLE; } my %checkallowed = ( coursediscussion => &Apache::lonnet::allowed('pch',$env{'request.course.id'}), handgrading => &Apache::lonnet::allowed('mgr',$env{'request.course.id'}), abovethreshold => &Apache::lonnet::allowed('vgr',$env{'request.course.id'}), haserrors => &Apache::lonnet::allowed('opa',$env{'request.course.id'}), versionchanges => &Apache::lonnet::allowed('opa',$env{'request.course.id'}), coursenormalmail => 1, coursecritmail => 1, ); $r->print(&display_header($command,\%checkallowed)); &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/whatsnew', text=>"Display Action Items"}); if (($command eq 'chgthreshold') && (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) { &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/whatsnew?command=chgthreshold', text=>"Change thresholds"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs (undef,'Course Action Items','Course_Action_Items_Thresholds')); } elsif (($command eq 'chginterval') && (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) { &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/whatsnew?command=chginterval', text=>"Change interval"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs (undef,'Course Action Items','Course_Action_Items_Intervals')); } else { $r->print(&Apache::lonhtmlcommon::breadcrumbs (undef,'Course Action Items','Course_Action_Items_Display')); } &display_main_box($r,$command,\%checkallowed); return OK; } #------------------------------ # display_main_box # # Display all the elements within the main box #------------------------------ sub display_main_box { my ($r,$command,$checkallowed) = @_; my $domain=&Apache::loncommon::determinedomain(); my $function = &Apache::loncommon::get_users_function(); my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); $r->print('
');
my %threshold_titles = (
av_attempts => 'Average number of attempts',
degdiff => 'Degree of difficulty',
numstudents => 'Total number of students with submissions',
);
my %interval_titles = (
-1 => 'since start of course',
2592000 => 'since last month',
604800 => 'since last week',
86400 => 'since yesterday',
);
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
if (($command eq 'chgthreshold') &&
(&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) {
&display_threshold_config($r,$command,$tabbg,\%threshold_titles,
$cdom,$crs);
} elsif (($command eq 'chginterval') &&
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) {
&display_interval_config($r,\%interval_titles);
} else {
&display_actions_box($r,$tabbg,$command,\%threshold_titles,
\%interval_titles,$cdom,$crs,$checkallowed);
}
$r->print(< |