Annotation of loncom/html/adm/helper/newslot.helper, revision 1.3
1.1 albertel 1: <helper title="Slot Creation" requiredpriv="mgq">
2: <state name="START" title="Specify Required Attributes">
3: <message nextstate="OPTIONAL">
4: <message_text>
5: Name: <br />
6: </message_text>
7: </message>
1.3 ! albertel 8: <string variable="name" size="30">
1.1 albertel 9: <validator>
10: if ($val=~/^\s*$/) { return 'Must specify a name'; }
11: if ($val=~/\s$/) { return 'Must not contain spaces'; }
12: return undef;
13: </validator>
14: </string>
15: <message>
16: <message_text><br />Start time:<br /> </message_text>
17: </message>
18: <date variable="starttime" hoursminutes="1"></date>
19: <message>
20: <message_text><br />End time:<br /> </message_text>
21: </message>
22: <date variable="endtime" hoursminutes="1"></date>
23: <message>
24: <message_text><br />Type:</message_text>
25: </message>
26: <choices variable="type">
27: <choice computer='preassigned'>Instructor asssignable.</choice>
28: <choice computer='student_schedulable'>Student selectable.</choice>
29: <defaultvalue>
30: return 'preassigned';
31: </defaultvalue>
32: </choices>
33: </state>
34:
35: <state name="OPTIONAL" title="Specify Optional Attributes">
36: <message>
37: <message_text>
1.2 albertel 38: <p>Description:<br />
1.1 albertel 39: </message_text>
40: </message>
1.2 albertel 41: <string variable="description" size="60"></string>
1.1 albertel 42: <message>
43: <message_text>
1.2 albertel 44: </p><p>Time students can start reserving:<br />
1.1 albertel 45: </message_text>
46: </message>
1.2 albertel 47: <date variable="startreserve" hoursminutes="1" anytime="1">
48: <defaultvalue>'anytime'</defaultvalue>
49: </date>
1.1 albertel 50: <message>
51: <message_text>
52: </p><p>Maxium number of students allowed in this slot:<br />
53: </message_text>
54: </message>
55: <string variable="maxspace" size="4">
56: <validator>
57: if ($val ne '' && $val=~/\D/) { return 'Must be numeric.'; }
58: return undef;
59: </validator>
60: </string>
61: <message>
62: <message_text>
1.3 ! albertel 63: </p><p>Secret word proctors use to checkin users:<br />
! 64: </message_text>
! 65: </message>
! 66: <string variable="secret" size="12">
! 67: <validator>
! 68: return undef;
! 69: </validator>
! 70: </string>
! 71: <message>
! 72: <message_text>
1.1 albertel 73: </p><p>Period of time in which this slot is can only be uniquely chosen:<br /> Start:
74: </message_text>
75: </message>
1.2 albertel 76: <date variable="startunique" hoursminutes="1" anytime="1">
77: <defaultvalue>'anytime'</defaultvalue>
78: </date>
1.1 albertel 79: <message><message_text><br /> End: </message_text></message>
1.2 albertel 80: <date variable="endunique" hoursminutes="1" anytime="1">
81: <defaultvalue>'anytime'</defaultvalue>
82: </date>
1.1 albertel 83: <message>
84: <message_text>
85: </p><p>Slot is:
86: </message_text>
87: </message>
88: <choices variable="restricttosymb">
89: <choice nextstate="FINISH" computer='any'>usable for any resource.</choice>
90: <choice nextstate="RESOURCESELECT" computer='resource'>restricted to a specific resource.</choice>
91: <defaultvalue>'any'</defaultvalue>
92: </choices>
1.2 albertel 93: <message>
94: <message_text>
95: </p><p>IP restrictions:<br />
96: </message_text>
97: </message>
98: <string variable="ip" size="30">
99: <validator>
100: return undef;
101: </validator>
102: </string>
1.1 albertel 103: <message> <message_text> </p> </message_text> </message>
104: </state>
105: <state name="RESOURCESELECT" title="Specify Optional Attributes">
106: <resource variable="symb">
107: <filterfunc>return $res->is_problem()</filterfunc>
108: <valuefunc>return $res->symb()</valuefunc>
109: <nextstate>FINISH</nextstate>
110: </resource>
111: </state>
1.3 ! albertel 112: <state name="FINISH" title="Creating/Modfying Slot">
! 113: <message> <message_text> Created Slot </message_text> </message>
! 114: <final>
! 115: <finalcode>
! 116: my $result;
! 117: if ($helper->{'STATE'} ne 'FINISH') { return; }
! 118: my %slot;
! 119: foreach my $which ('type','starttime','endtime') {
! 120: $slot{$which} = $helper->{'VARS'}{$which};
! 121: }
! 122: foreach my $which ('ip','proctor','description','maxspace',
! 123: 'secret','symb') {
! 124: if ( $helper->{'VARS'}{$which} =~/\S/ ) {
! 125: $slot{$which} = $helper->{'VARS'}{$which};
! 126: }
! 127: }
! 128: if ( $helper->{'VARS'}{'startunique'} > 0 &&
! 129: $helper->{'VARS'}{'endunique'} > 0 ) {
! 130: $slot{'uniqueperiod'} = [$helper->{'VARS'}{'startunique'},
! 131: $helper->{'VARS'}{'endunique'}];
! 132: }
! 133: my $cname = $env{'course.'.$env{'request.course.id'}.'.num'};
! 134: my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
! 135:
! 136: my $ret = &Apache::lonnet::cput('slots',
! 137: {$helper->{'VARS'}{'name'} => \%slot},
! 138: $cdom,$cname);
! 139: $result.="\n".'<li> Name: '.&HTML::Entities::encode($slot{name}).'</li>'.
! 140: "\n".'<li> Starts: '.&Apache::lonlocal::locallocaltime($slot{start}).'</li>'.
! 141: "\n".'<li> Ends: '.&Apache::lonlocal::locallocaltime($slot{end}).'</li>'.
! 142: "\n".'<li> Type: '.$slot{'type'}.'</li>';
! 143: my %labels =
! 144: map {($_->[0],$_->[1])} &Apache::slotrequest::csvupload_fields();
! 145: foreach my $which ('ip','proctor','description','maxspace',
! 146: 'secret','symb') {
! 147: if (exists($slot{$which})) {
! 148: $result.="\n".'<li> '.$labels{$which}.': '.
! 149: &HTML::Entities::encode($slot{$which}).'</li>';
! 150: }
! 151: }
! 152: if (exists($slot{'uniqueperiod'})) {
! 153: $result.=
! 154: "\n".'<li> '.$labels{'uniqueperiod'}.': '.
! 155: &Apache::lonlocal::locallocaltime($slot{'uniqueperiod'}[0]).
! 156: ', '.
! 157: &Apache::lonlocal::locallocaltime($slot{'uniqueperiod'}[1]).
! 158: '</li>';
! 159: }
! 160: return $result;
! 161: </finalcode>
! 162: <exitpage>/adm/flip?postdata=return:</exitpage>
! 163: </final>
1.1 albertel 164: </state>
165: </helper>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>