[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm /interface lonparmset.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 02 Aug 2007 00:42:43 -0000
albertel Wed Aug 1 20:42:43 2007 EDT
Modified files:
/loncom/homework bridgetask.pm
/loncom/interface lonparmset.pm
Log:
- BUG#5333 - task grading can be set to restricted to only allow grading by the section of the selected role
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.234 loncom/homework/bridgetask.pm:1.235
--- loncom/homework/bridgetask.pm:1.234 Wed Aug 1 19:57:35 2007
+++ loncom/homework/bridgetask.pm Wed Aug 1 20:42:35 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.234 2007/08/01 23:57:35 albertel Exp $
+# $Id: bridgetask.pm,v 1.235 2007/08/02 00:42:35 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -244,7 +244,9 @@
my $result="\n\t".'<input type="submit" name="gradeasubmission" value="'.
&mt("Get a submission to grade").'" />';
$result.="\n\t".'<input type="hidden" name="grade_target" value="webgrade" />';
- if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
+ if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})
+ || &Apache::lonnet::allowed('mgq',$env{'request.course.id'}.'/'.$env{'request.course.sec'})
+ ) {
my ($entries,$ready,$locks)=&get_queue_counts('gradingqueue');
$result.="\n\t".'<table>'."\n\t\t".'<tr>';
$result.="\n\t\t\t".'<td rowspan="4">Specify a section: </td>'.
@@ -610,7 +612,8 @@
if ($env{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); }
$result.=$uri.'">'.&add_grading_button()."</form>\n";
my $symb=&Apache::lonnet::symbread();
- if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
+ if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})
+ || &Apache::lonnet::allowed('mgq',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
$result.='<form method="post" name="slotrequest" action="/adm/slotrequest">'.
'<input type="hidden" name="symb" value="'.$symb.'" />'.
'<input type="hidden" name="command" value="showslots" />'.
@@ -1585,7 +1588,8 @@
&Apache::loncommon::end_data_table_header_row();
foreach my $key (sort(keys(%queue))) {
my ($symb,$uname,$udom) = &decode_queue_key($key);
- if (!defined($classlist->{$uname.':'.$udom})) { next; }
+ next if (!defined($classlist->{$uname.':'.$udom}));
+ next if (§ion_restricted($classlist->{$uname.':'.$udom}));
my $section = $classlist->{$uname.':'.$udom}[&Apache::loncoursedata::CL_SECTION()];
@@ -1671,6 +1675,18 @@
return $result;
}
+sub section_restricted {
+ my ($classlist_entry) = @_;
+ my $cid =(&Apache::lonnet::whichuser())[1];
+ if (lc($env{'course.'.$cid.'.task_grading'}) eq 'section'
+ && $env{'request.course.sec'}
+ && $env{'request.course.sec'} ne
+ $classlist_entry->[&Apache::loncoursedata::CL_SECTION()]) {
+ return 1;
+ }
+ return 0;
+}
+
sub get_queue_counts {
my ($queue)=@_;
my $result;
@@ -1686,11 +1702,14 @@
if ($tmp=~/^error: 2 /) {
return (0,0,0);
}
+
my ($entries,$ready_to_grade,$locks)=(0,0,0);
my %slot_cache;
foreach my $key (sort(keys(%queue))) {
my ($symb,$uname,$udom) = &decode_queue_key($key);
- if (!defined($classlist->{$uname.':'.$udom})) { next; }
+ next if (!defined($classlist->{$uname.':'.$udom}));
+ next if (§ion_restricted($classlist->{$uname.':'.$udom}));
+
if ($key=~/locked$/) {
$locks++;
} elsif ($key=~/timestamp$/) {
@@ -1767,7 +1786,8 @@
if ($key =~ /\0timestamp$/) { next; }
my ($symb,$uname,$udom)=&decode_queue_key($key);
- if (!defined($classlist->{$uname.':'.$udom})) { next; }
+ next if (!defined($classlist->{$uname.':'.$udom}));
+ next if (§ion_restricted($classlist->{$uname.':'.$udom}));
if ($check_section) {
my $section =
@@ -1876,7 +1896,7 @@
sub get_queue_symb_status {
my ($queue,$symb,$cdom,$cnum) = @_;
if (!defined($cdom) || !defined($cnum)) {
- my (undef,$cid)=&Apache::lonnet::whichuser();
+ my (undef,$cid) =&Apache::lonnet::whichuser();
$cnum=$env{'course.'.$cid.'.num'};
$cdom=$env{'course.'.$cid.'.domain'};
}
@@ -1892,6 +1912,7 @@
next if ($key=~/timestamp$/);
my ($symb,$uname,$udom) = &decode_queue_key($key);
next if (!defined($classlist->{$uname.':'.$udom}));
+ next if (§ion_restricted($classlist->{$uname.':'.$udom}));
push(@users,"$uname:$udom");
}
return @users;
@@ -2695,7 +2716,8 @@
sub grading_history {
my ($version,$dim,$id) = @_;
- if (!&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
+ if (!&Apache::lonnet::allowed('mgq',$env{'request.course.id'})
+ && !&Apache::lonnet::allowed('mgq',$env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
return '';
}
my ($result,$grader);
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.372 loncom/interface/lonparmset.pm:1.373
--- loncom/interface/lonparmset.pm:1.372 Thu Jul 19 20:15:06 2007
+++ loncom/interface/lonparmset.pm Wed Aug 1 20:42:43 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.372 2007/07/20 00:15:06 raeburn Exp $
+# $Id: lonparmset.pm,v 1.373 2007/08/02 00:42:43 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2147,6 +2147,8 @@
'cloners' => '<b>'.&mt('Users allowed to clone course').'</b><br /><tt>(user:domain,user:domain)</tt><br />'.&mt('Users with active Course Coordinator role in the course automatically have the right to clone it, and can be omitted from list.'),
'grading' => '<b>'.&mt('Grading').'</b><br />'.
'<tt>"standard", "external", or "spreadsheet"</tt> '.&Apache::loncommon::help_open_topic('GradingOptions'),
+ 'task_grading' => '<b>'.&mt('Bridge Task Grading').'</b><br />'.
+ &mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections, "[_1]" they are allowed (this is the default), "[_2]" no, they can only grade their own section','<tt>any</tt>','<tt>section</tt>'),
'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b> '.
'<a href="javascript:openbrowser'.
"('envform','default_xml_style'".
@@ -2289,7 +2291,7 @@
'texengine',
'disablesigfigs',
'disableexampointprint',
- 'task_messages'
+ 'task_messages','task_grading',
);
foreach my $parameter (sort(keys(%values))) {
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) {