[LON-CAPA-cvs] cvs: loncom /html/adm/helper newslot.helper
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 14 Oct 2005 22:17:33 -0000
albertel Fri Oct 14 18:17:33 2005 EDT
Modified files:
/loncom/html/adm/helper newslot.helper
Log:
- okay helper actually creates the slot now (still missing proctor specifying)
Index: loncom/html/adm/helper/newslot.helper
diff -u loncom/html/adm/helper/newslot.helper:1.2 loncom/html/adm/helper/newslot.helper:1.3
--- loncom/html/adm/helper/newslot.helper:1.2 Tue Oct 11 17:12:48 2005
+++ loncom/html/adm/helper/newslot.helper Fri Oct 14 18:17:33 2005
@@ -5,7 +5,7 @@
Name: <br />
</message_text>
</message>
- <string variable="slotname" size="30">
+ <string variable="name" size="30">
<validator>
if ($val=~/^\s*$/) { return 'Must specify a name'; }
if ($val=~/\s$/) { return 'Must not contain spaces'; }
@@ -60,6 +60,16 @@
</string>
<message>
<message_text>
+ </p><p>Secret word proctors use to checkin users:<br />
+ </message_text>
+ </message>
+ <string variable="secret" size="12">
+ <validator>
+ return undef;
+ </validator>
+ </string>
+ <message>
+ <message_text>
</p><p>Period of time in which this slot is can only be uniquely chosen:<br /> Start:
</message_text>
</message>
@@ -99,7 +109,57 @@
<nextstate>FINISH</nextstate>
</resource>
</state>
- <state name="FINISH" title="Specify Optional Attributes">
- <message> <message_text> fin </message_text> </message>
+ <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','proctor','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'}];
+ }
+ 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>'.
+ "\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/flip?postdata=return:</exitpage>
+ </final>
</state>
</helper>