version 1.1, 2005/10/11 20:47:02
|
version 1.4, 2005/10/17 18:21:26
|
Line 5
|
Line 5
|
Name: <br /> |
Name: <br /> |
</message_text> |
</message_text> |
</message> |
</message> |
<string variable="slotname" size="30"> |
<string variable="name" size="30"> |
<validator> |
<validator> |
if ($val=~/^\s*$/) { return 'Must specify a name'; } |
if ($val=~/^\s*$/) { return 'Must specify a name'; } |
if ($val=~/\s$/) { return 'Must not contain spaces'; } |
if ($val=~/\s$/) { return 'Must not contain spaces'; } |
Line 35
|
Line 35
|
<state name="OPTIONAL" title="Specify Optional Attributes"> |
<state name="OPTIONAL" title="Specify Optional Attributes"> |
<message> |
<message> |
<message_text> |
<message_text> |
<p>Time students can start reserving:<br /> |
<p>Description:<br /> |
</message_text> |
</message_text> |
</message> |
</message> |
<date variable="startreserve" hoursminutes="1" anytime="1"></date> |
<string variable="description" size="60"></string> |
<message> |
<message> |
<message_text> |
<message_text> |
</p><p>IP restrictions:<br /> |
</p><p>Time students can start reserving:<br /> |
</message_text> |
</message_text> |
</message> |
</message> |
<string variable="ip" size="30"> |
<date variable="startreserve" hoursminutes="1" anytime="1"> |
|
<defaultvalue>'anytime'</defaultvalue> |
|
</date> |
|
<message> |
|
<message_text> |
|
</p><p>Maxium number of students allowed in this slot:<br /> |
|
</message_text> |
|
</message> |
|
<string variable="maxspace" size="4"> |
<validator> |
<validator> |
|
if ($val ne '' && $val=~/\D/) { return 'Must be numeric.'; } |
return undef; |
return undef; |
</validator> |
</validator> |
</string> |
</string> |
<message> |
<message> |
<message_text> |
<message_text> |
</p><p>Description:<br /> |
</p><p>Secret word proctors use to checkin users:<br /> |
</message_text> |
</message_text> |
</message> |
</message> |
<string variable="description" size="60"></string> |
<string variable="secret" size="12"> |
<message> |
|
<message_text> |
|
</p><p>Maxium number of students allowed in this slot:<br /> |
|
</message_text> |
|
</message> |
|
<string variable="maxspace" size="4"> |
|
<validator> |
<validator> |
if ($val ne '' && $val=~/\D/) { return 'Must be numeric.'; } |
|
return undef; |
return undef; |
</validator> |
</validator> |
</string> |
</string> |
Line 71
|
Line 73
|
</p><p>Period of time in which this slot is can only be uniquely chosen:<br /> Start: |
</p><p>Period of time in which this slot is can only be uniquely chosen:<br /> Start: |
</message_text> |
</message_text> |
</message> |
</message> |
<date variable="startunique" hoursminutes="1" anytime="1"></date> |
<date variable="startunique" hoursminutes="1" anytime="1"> |
|
<defaultvalue>'anytime'</defaultvalue> |
|
</date> |
<message><message_text><br /> End: </message_text></message> |
<message><message_text><br /> End: </message_text></message> |
<date variable="endunique" hoursminutes="1" anytime="1"></date> |
<date variable="endunique" hoursminutes="1" anytime="1"> |
|
<defaultvalue>'anytime'</defaultvalue> |
|
</date> |
<message> |
<message> |
<message_text> |
<message_text> |
</p><p>Slot is: |
</p><p>Slot is: |
</message_text> |
</message_text> |
</message> |
</message> |
<choices variable="restricttosymb"> |
<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> |
<choice nextstate="RESOURCESELECT" computer='resource'>restricted to a specific resource.</choice> |
<defaultvalue>'any'</defaultvalue> |
<defaultvalue>'any'</defaultvalue> |
</choices> |
</choices> |
|
<message> |
|
<message_text> |
|
</p><p>IP restrictions:<br /> |
|
</message_text> |
|
</message> |
|
<string variable="ip" size="30"> |
|
<validator> |
|
return undef; |
|
</validator> |
|
</string> |
<message> <message_text> </p> </message_text> </message> |
<message> <message_text> </p> </message_text> </message> |
</state> |
</state> |
<state name="RESOURCESELECT" title="Specify Optional Attributes"> |
<state name="RESOURCESELECT" title="Specify Optional Attributes"> |
<resource variable="symb"> |
<resource variable="symb"> |
<filterfunc>return $res->is_problem()</filterfunc> |
<filterfunc>return $res->is_problem()</filterfunc> |
<valuefunc>return $res->symb()</valuefunc> |
<valuefunc>return $res->symb()</valuefunc> |
<nextstate>FINISH</nextstate> |
<nextstate>PROCTOR</nextstate> |
</resource> |
</resource> |
</state> |
</state> |
<state name="FINISH" title="Specify Optional Attributes"> |
<state name="PROCTOR" title="Specify Proctors"> |
<message> <message_text> fin </message_text> </message> |
<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> |
|
<finalcode> |
|
my $result; |
|
if ($helper->{'STATE'} ne 'FINISH') { return; } |
|
my %slot; |
|
foreach my $which ('type','starttime','endtime') { |
|
$slot{$which} = $helper->{'VARS'}{$which}; |
|
} |
|
foreach my $which ('ip','description','maxspace', |
|
'secret','symb') { |
|
if ( $helper->{'VARS'}{$which} =~/\S/ ) { |
|
$slot{$which} = $helper->{'VARS'}{$which}; |
|
} |
|
} |
|
if ( $helper->{'VARS'}{'startunique'} > 0 && |
|
$helper->{'VARS'}{'endunique'} > 0 ) { |
|
$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$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(); |
|
foreach my $which ('ip','proctor','description','maxspace', |
|
'secret','symb') { |
|
if (exists($slot{$which})) { |
|
$result.="\n".'<li> '.$labels{$which}.': '. |
|
&HTML::Entities::encode($slot{$which}).'</li>'; |
|
} |
|
} |
|
if (exists($slot{'uniqueperiod'})) { |
|
$result.= |
|
"\n".'<li> '.$labels{'uniqueperiod'}.': '. |
|
&Apache::lonlocal::locallocaltime($slot{'uniqueperiod'}[0]). |
|
', '. |
|
&Apache::lonlocal::locallocaltime($slot{'uniqueperiod'}[1]). |
|
'</li>'; |
|
} |
|
return $result; |
|
</finalcode> |
|
<exitpage>/adm/slotrequest?command=showslots</exitpage> |
|
</final> |
</state> |
</state> |
</helper> |
</helper> |