[LON-CAPA-cvs] cvs: loncom /html/adm/helper newslot.helper /interface lonhelper.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 17 Oct 2005 18:21:26 -0000
albertel Mon Oct 17 14:21:26 2005 EDT
Modified files:
/loncom/interface lonhelper.pm
/loncom/html/adm/helper newslot.helper
Log:
- okay can spec out proctors now
- helper <student> selector now allows empty choices as a possibility
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.122 loncom/interface/lonhelper.pm:1.123
--- loncom/interface/lonhelper.pm:1.122 Tue Oct 11 18:05:20 2005
+++ loncom/interface/lonhelper.pm Mon Oct 17 14:20:59 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.122 2005/10/11 22:05:20 albertel Exp $
+# $Id: lonhelper.pm,v 1.123 2005/10/17 18:20:59 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2189,6 +2189,10 @@
If true, only active students and course personnel will be
shown. Defaults to false.
+=item * B<emptyallowed>:
+
+If true, the selection of no users is allowed. Defaults to false.
+
=back
=cut
@@ -2224,6 +2228,7 @@
if (defined($token->[2]{'nextstate'})) {
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'};
}
+ $paramHash->{'emptyallowed'} = $token->[2]{'emptyallowed'};
}
@@ -2485,9 +2490,14 @@
my $self = shift;
my $result = $env{'form.' . $self->{'variable'} . '.forminput'};
- if (!$result) {
- $self->{ERROR_MSG} =
- &mt('You must choose at least one student to continue.');
+ if (!$result && !$self->{'emptyallowed'}) {
+ if ($self->{'coursepersonnel'}) {
+ $self->{ERROR_MSG} =
+ &mt('You must choose at least one user to continue.');
+ } else {
+ $self->{ERROR_MSG} =
+ &mt('You must choose at least one student to continue.');
+ }
return 0;
}
Index: loncom/html/adm/helper/newslot.helper
diff -u loncom/html/adm/helper/newslot.helper:1.3 loncom/html/adm/helper/newslot.helper:1.4
--- loncom/html/adm/helper/newslot.helper:1.3 Fri Oct 14 18:17:33 2005
+++ loncom/html/adm/helper/newslot.helper Mon Oct 17 14:21:26 2005
@@ -86,7 +86,7 @@
</message_text>
</message>
<choices variable="restricttosymb">
- <choice nextstate="FINISH" computer='any'>usable for any resource.</choice>
+ <choice nextstate="PROCTOR" computer='any'>usable for any resource.</choice>
<choice nextstate="RESOURCESELECT" computer='resource'>restricted to a specific resource.</choice>
<defaultvalue>'any'</defaultvalue>
</choices>
@@ -106,9 +106,14 @@
<resource variable="symb">
<filterfunc>return $res->is_problem()</filterfunc>
<valuefunc>return $res->symb()</valuefunc>
- <nextstate>FINISH</nextstate>
+ <nextstate>PROCTOR</nextstate>
</resource>
</state>
+ <state name="PROCTOR" title="Specify Proctors">
+ <student variable="proctor" multichoice="1" coursepersonnel="1"
+ nextstate="FINISH" activeonly="1" emptyallowed="1">
+ </student>
+ </state>
<state name="FINISH" title="Creating/Modfying Slot">
<message> <message_text> Created Slot </message_text> </message>
<final>
@@ -119,7 +124,7 @@
foreach my $which ('type','starttime','endtime') {
$slot{$which} = $helper->{'VARS'}{$which};
}
- foreach my $which ('ip','proctor','description','maxspace',
+ foreach my $which ('ip','description','maxspace',
'secret','symb') {
if ( $helper->{'VARS'}{$which} =~/\S/ ) {
$slot{$which} = $helper->{'VARS'}{$which};
@@ -130,15 +135,23 @@
$slot{'uniqueperiod'} = [$helper->{'VARS'}{'startunique'},
$helper->{'VARS'}{'endunique'}];
}
+ if ( $helper->{'VARS'}{'proctor'} =~/\S/ ) {
+ my @names;
+ foreach my $user (split(/\|\|\|/, $helper->{'VARS'}{'proctor'})) {
+ my ($uname,$udomain)=split(/:/,$user);
+ push(@names,"$uname\@$udomain");
+ }
+ $slot{'proctor'}=join(',',@names);
+ }
my $cname = $env{'course.'.$env{'request.course.id'}.'.num'};
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $ret = &Apache::lonnet::cput('slots',
{$helper->{'VARS'}{'name'} => \%slot},
$cdom,$cname);
- $result.="\n".'<li> Name: '.&HTML::Entities::encode($slot{name}).'</li>'.
- "\n".'<li> Starts: '.&Apache::lonlocal::locallocaltime($slot{start}).'</li>'.
- "\n".'<li> Ends: '.&Apache::lonlocal::locallocaltime($slot{end}).'</li>'.
+ $result.="\n$ret ".'Name: '.&HTML::Entities::encode($helper->{'VARS'}{'name'}).'</li>'.
+ "\n".'<li> Starts: '.&Apache::lonlocal::locallocaltime($slot{'starttime'}).'</li>'.
+ "\n".'<li> Ends: '.&Apache::lonlocal::locallocaltime($slot{'endtime'}).'</li>'.
"\n".'<li> Type: '.$slot{'type'}.'</li>';
my %labels =
map {($_->[0],$_->[1])} &Apache::slotrequest::csvupload_fields();
@@ -159,7 +172,7 @@
}
return $result;
</finalcode>
- <exitpage>/adm/flip?postdata=return:</exitpage>
+ <exitpage>/adm/slotrequest?command=showslots</exitpage>
</final>
</state>
</helper>