[LON-CAPA-cvs] cvs: loncom /interface lonrequestcourse.pm
raeburn
raeburn@source.lon-capa.org
Tue, 30 Mar 2010 15:01:17 -0000
raeburn Tue Mar 30 15:01:17 2010 EDT
Modified files:
/loncom/interface lonrequestcourse.pm
Log:
- Default for cloning radiobutton to "No".
- Fix args in call to &header() when displaying warning message when displaying
existing request.
- Change args passed to &sorted_request_history()
- replace third and fourth args with a single arg (ref to Hash of current filters (status, before, after, crstype).
- Check for form.queue (either approval or pending) to allow manual approval/rejection official courses pendng validation of instructor of record.
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.48 loncom/interface/lonrequestcourse.pm:1.49
--- loncom/interface/lonrequestcourse.pm:1.48 Fri Mar 19 13:23:05 2010
+++ loncom/interface/lonrequestcourse.pm Tue Mar 30 15:01:17 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.48 2010/03/19 13:23:05 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.49 2010/03/30 15:01:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -128,7 +128,7 @@
}
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['action','showdom','cnum','state','crstype']);
+ ['action','showdom','cnum','state','crstype','queue']);
&Apache::lonhtmlcommon::clear_breadcrumbs();
my $dom = &get_course_dom();
my $action = $env{'form.action'};
@@ -179,7 +179,8 @@
if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {
if ($env{'form.cnum'} ne '') {
my $cnum = $env{'form.cnum'};
- my $reqkey = $cnum.'_approval';
+ my $queue = $env{'form.queue'};
+ my $reqkey = $cnum.'_'.$queue;
my $namespace = 'courserequestqueue';
my $domconfig = &Apache::lonnet::get_domainconfiguser($dom);
my %queued =
@@ -317,7 +318,7 @@
} elsif ($action eq 'display') {
if ($warning ne '') {
my $args = { only_body => 1 };
- $r->print(&header('Course/Community Requests','','',$args).$crumb.
+ $r->print(&header('Course/Community Requests','','' ,'',$args).$crumb.
'<h3>'.&mt('Course/Community Request Details').'</h3>'.
'<div class="LC_warning">'.$warning.'</div>'.
&close_popup_form());
@@ -1861,7 +1862,20 @@
}
sub sorted_request_history {
- my ($dom,$action,$after,$before) = @_;
+ my ($dom,$action,$curr_req) = @_;
+ my ($after,$before,$statusfilter,$crstypefilter);
+ if ($env{'form.status'} ne '') {
+ $statusfilter = $env{'form.status'};
+ }
+ if ($env{'form.crstype'} ne '') {
+ $crstypefilter = $env{'form.crstype'};
+ }
+ if (ref($curr_req) eq 'HASH') {
+ $after = $curr_req->{'requested_after_date'},
+ $before = $curr_req->{'requested_before_date'};
+ $statusfilter = $curr_req->{'status'};
+ $crstypefilter = $curr_req->{'crstype'};
+ }
my %statusinfo = &Apache::lonnet::dump('courserequests',$env{'user.domain'},
$env{'user.name'},'^status:'.$dom);
my %queue_by_date;
@@ -1870,8 +1884,8 @@
if ($action eq 'view') {
next unless (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending'));
} else {
- next unless (($env{'form.status'} eq 'any') ||
- ($env{'form.status'} eq $statusinfo{$key}));
+ next unless (($statusfilter eq 'any') ||
+ ($statusfilter eq $statusinfo{$key}));
}
(undef,my($cdom,$cnum)) = split(':',$key);
next if ($cdom ne $dom);
@@ -1890,8 +1904,8 @@
} else {
next if (($reqtime < $after) || ($reqtime > $before));
}
- next unless (($env{'form.crstype'} eq 'any') ||
- ($env{'form.crstype'} eq $crstype));
+ next unless (($crstypefilter eq 'any') ||
+ ($crstypefilter eq $crstype));
if ($action eq 'view') {
next unless (($disposition eq 'approval') ||
($disposition eq 'pending'));
@@ -2154,9 +2168,7 @@
my ($statuses,$statusnames) = &reqstatus_names($curr{'crstype'});
$r->print('<input type="hidden" name="page" value="'.$curr{'page'}.'" />'.
&requestlog_display_filter($formname,\%curr));
- my %queue_by_date = &sorted_request_history($dom,$env{'form.action'},
- $curr{'requested_after_date'},
- $curr{'requested_before_date'});
+ my %queue_by_date = &sorted_request_history($dom,$env{'form.action'},\%curr);
my @sortedtimes = sort {$a <=> $b} (keys(%queue_by_date));
my $showntablehdr = 0;
my $tablehdr = &Apache::loncommon::start_data_table().
@@ -2756,7 +2768,7 @@
'<label><input type="radio" name="cloning" value="1" '.
'onclick="javascript:toggleCloning()" />'.
&mt('Yes').(' 'x2).'</label><label>'.
- '<input type="radio" name="cloning" value="0" '.
+ '<input type="radio" name="cloning" value="0" checked="checked" '.
'onclick="javascript:toggleCloning()" />'.&mt('No').'</label>'.
'</h3>'.
&Apache::lonhtmlcommon::row_closure(1).
@@ -3286,6 +3298,9 @@
description => $env{'form.cdescr'},
},
};
+ if ($crstype eq 'official') {
+ $request->{$requestid}->{'instcode'} = $instcode;
+ }
my $statuskey = 'status:'.$dom.':'.$cnum;
my %userreqhash = &Apache::lonnet::get('courserequests',[$statuskey],
$env{'user.domain'},$env{'user.name'});