--- loncom/interface/lonwhatsnew.pm 2005/04/05 22:49:17 1.1
+++ loncom/interface/lonwhatsnew.pm 2005/12/19 21:39:37 1.39
@@ -1,15 +1,44 @@
+#
+# $Id: lonwhatsnew.pm,v 1.39 2005/12/19 21:39:37 raeburn 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::lonuserstate;
use Apache::Constants qw(:common :http);
use Time::Local;
+use GDBM_File;
#----------------------------
# handler
@@ -18,22 +47,74 @@ use Time::Local;
sub handler {
my $r = shift;
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['command']);
-
- my $command = $ENV{'form.command'};
-
- if ($command eq '') {
- $command = "info";
+ 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','refpage']);
+
+ my $command = $env{'form.command'};
+ my $refpage = $env{'form.refpage'};
- $r->print(&display_header());
- if (! (($ENV{'request.course.fn'}) && (&Apache::lonnet::allowed('vsa',$ENV{'request.course.id'})))) {
- # Not in a course, or not allowed to modify parms
- $ENV{'user.error.msg'}="/adm/whatsnew:vsa:0:0:Cannot display student activity";
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ my $crsid = $env{'request.course.id'};
+ $crsid =~ s/_/\//;
+ if ((!($env{'request.course.id'})) ||
+ ($env{'request.role'} !~ /\Q$crsid\E$/)) {
+ # Not in a course, or no role in course
+ $env{'user.error.msg'}="/adm/whatsnew::0:0:Cannot display what's new screen";
return HTTP_NOT_ACCEPTABLE;
}
- &display_main_box($r,$command);
+ 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&refpage='.$refpage,
+ 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&refpage='.$refpage,
+ text=>"Change interval"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Course Action Items','Course_Action_Items_Intervals'));
+ } elsif (($command eq 'chgdisc') && (&Apache::lonnet::allowed('pch',$env{'request.course.id'}))) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/whatsnew?command=chgdisc&refpage='.$refpage,
+ text=>"Change discussion display"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Course Action Items','Course_Action_Items_Intervals'));
+ } elsif ($command eq 'courseinit') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/whatsnew?command=courseinit&refpage='.$refpage,
+ text=>"Course initialization preference"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Course Action Items','Course_Action_Items_Initialization'));
+ } else {
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Course Action Items','Course_Action_Items_Display'));
+ }
+ &display_main_box($r,$command,$refpage,\%checkallowed);
+ return OK;
}
#------------------------------
@@ -43,66 +124,50 @@ sub handler {
#------------------------------
sub display_main_box {
- my ($r,$command) = @_;
+ my ($r,$command,$refpage,$checkallowed) = @_;
my $domain=&Apache::loncommon::determinedomain();
my $tabbg=&Apache::loncommon::designparm('coordinator.tabbg',$domain);
- $r->print(<
-
-
+
+
+
+
+
+ ');
+}
-## MESSAGES ##
- $r->print(<
+#-------------------------------
+# display_threshold_config
+#
+# Display the threshold setting screen
+#
+#-------------------------------
+
+sub display_threshold_config {
+ my ($r,$refpage,$tabbg,$threshold_titles,$cdom,$crs) = @_;
+ my $uname = $env{'user.name'};
+ my $udom = $env{'user.dom'};
+ my $cid = $env{'request.course.id'};
+ my %threshold = ();
+ my $rowColor1 = "#ffffff";
+ my $rowColor2 = "#eeeeee";
+ my $rowColor;
+
+ my @thresholditems = ("av_attempts","degdiff","numstudents");
+ foreach my $item (@thresholditems) {
+ $threshold{$item} = '';
+ }
+ my %threshold_titles = &Apache::lonlocal::texthash(
+ av_attempts => 'Average number of attempts',
+ degdiff => 'Degree of difficulty',
+ numstudents => 'Total number of students with submissions',
+ );
+ &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs);
+
+ $r->print(' ');
+ return;
+}
- $r->print(<
-
-
-
-
-
New critical messages in course
-
-
-
+#----------------------------------------------
+# display_discussion_config
+#
+# Display the discussion display setting screen
+#
+#----------------------------------------------
+
+sub display_discussion_config {
+ my ($r,$refpage) = @_;
+ my $current = &get_current($env{'user.name'},$env{'user.domain'},
+ $env{'request.course.id'},'countunread');
+ if ($current eq '') {
+ $current = 'on';
+ }
+ my %status = (
+ on => 'checked="checked"',
+ off => 'checked="checked"',
+ );
+ $status{$current} = '';
+ $r->print(' '.&mt('Choose whether or not to display a count of the number of new posts for each resource or bulletin board which has unread posts.').' '.&mt('This can increase the time taken to gather data for the [_1] page by a few seconds.',"What's New?").' '.&mt('Currently set to [_1] .'),"$current.");
+ $r->print('
+');
+ return;
+}
+
+#---------------------------------------------------
+# courseinit_config
+#
+# Set page displayed when course loads after
+# selecting a role in the course from the roles page.
+#
+#---------------------------------------------------
+
+sub courseinit_config {
+ my ($r,$refpage,$initpage) = @_;
+ my ($control,$current) = &curr_courseinit();
+ my @chgstate = ('userpref','coursespecific');
+ my @chgentry = ('firstres','whatsnew');
+ my %lt = &Apache::lonlocal::texthash(
+ 'chwp' => 'Choose which page will be displayed when you enter this course after selecting a role.',
+ 'cuva' => 'Current value is determined by',
+ 'anis' => 'and is set to display',
+ 'padc' => 'Page display controlled by',
+ 'chce' => 'Choose course entry',
+ 'moce' => 'Modify course entry',
+ );
+ $r->print(<<"END");
+ $lt{'chwp'}
+ $lt{'cuva'}:
+$$initpage{$control} $lt{'anis'}
+$$initpage{$current}.
+');
+ return;
+}
- if ($critmsgcount > 0) {
- my $rowNum = 0;
- my $mailcount = 1;
- foreach my $msg (@critmsgs) {
- if ($rowNum %2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
- }
- $r->print('