1: <helper title="Course Parameter Helper" requiredpriv='opa'>
2:
3: <exec>
4: # 'dateTypeHash' should really be renamed now that we have tries...
5: my %dateTypeHash = ('open_date' => "opening date",
6: 'due_date' => "due date",
7: 'answer_date' => "answer open date",
8: 'tries' => 'number of tries',
9: 'weight' => 'problem weight'
10: );
11: my %levelTypeHash = ('whole_course' => "all problems in the course",
12: 'map' => 'the selected folder',
13: 'resource' => 'the selected problem');
14: $helper->{DATA}->{'dateTypeHash'} = \%dateTypeHash;
15: $helper->{DATA}->{'levelTypeHash'} = \%levelTypeHash;
16:
17: $helper->{DATA}->{'levelType'} = sub {
18: return $helper->{DATA}->{'levelTypeHash'}->{$helper->{VARS}->{GRANULARITY}};
19: };
20:
21: $helper->{DATA}->{'dateType'} = sub {
22: return $helper->{DATA}->{'dateTypeHash'}->{$helper->{VARS}->{ACTION_TYPE}};
23: };
24:
25: </exec>
26:
27: <state name="START" title="Welcome to the Assignment Parameter Helper">
28: <message nextstate="CHOOSE_LEVEL">
29: <p>This helper will assist you in <b>setting the open,
30: due, and answer dates</b> for problems, or in
31: <b>setting the number of tries</b> for problems.</p>
32:
33: <p>You will be asked to <b>select which problems</b> you wish to
34: set the parameters for, then <b>what parameter</b> you
35: wish to set, then you will select <b>whom the setting
36: affects</b>.</p>
37:
38: <p>After the helper is done, you will be shown where in
39: the advanced interface you would have gone to set
40: the parameter you have chosen, so in the future you
41: can do it directly.</p>
42:
43: <p>Press <b>Next -></b> to begin, or select <b><-
44: Previous</b> to go back to the previous screen.</p>
45: </message>
46: </state>
47:
48: <state name="CHOOSE_LEVEL" title="Which Problem or Problems?">
49: <message>Which problems do you wish to set a parameter for?</message>
50: <choices variable="GRANULARITY">
51: <choice computer="whole_course" nextstate="CHOOSE_ACTION">
52: Course default for all problems
53: </choice>
54: <choice computer="map" nextstate="CHOOSE_FOLDER">
55: Every problem in a particular folder (overrides course default)
56: </choice>
57: <choice computer="resource" nextstate="CHOOSE_RESOURCE">
58: One particular problem (overrides folder and course defaults)
59: </choice>
60: </choices>
61: </state>
62:
63: <state name="CHOOSE_FOLDER" title="Select Folder">
64: <message>Select the folder you wish to set the parameter for:</message>
65:
66: <resource variable="RESOURCE_ID">
67: <nextstate>CHOOSE_ACTION</nextstate>
68: <filterfunc>return $res->is_map()</filterfunc>
69: <valuefunc>return $res->map_pc();</valuefunc>
70: </resource>
71: </state>
72:
73: <state name="CHOOSE_RESOURCE" title="Select Problem">
74: <message>Select the problem you wish to set the parameter for:</message>
75:
76: <resource variable="RESOURCE_ID" nextstate="CHOOSE_ACTION" addparts="true">
77: <nextstate>CHOOSE_ACTION</nextstate>
78: <filterfunc>return $res->is_map || $res->is_problem()</filterfunc>
79: <choicefunc>return $res->is_problem()</choicefunc>
80: </resource>
81: </state>
82:
83: <state name="CHOOSE_ACTION" title="Parameter Type">
84: <eval>return 'What parameter do you want to set for ' .
85: &{$helper->{DATA}->{'levelType'}}()
86: . '?';
87: </eval>
88: <choices variable="ACTION_TYPE">
89: <nextstate>CHOOSE_DATE</nextstate>
90: <choice computer="open_date" nextstate="CHOOSE_DATE">Set an <b>open date</b></choice>
91: <choice computer="due_date" nextstate="CHOOSE_DATE">Set a <b>due date</b></choice>
92: <choice computer="answer_date" nextstate="CHOOSE_DATE">Set an <b>answer open date</b></choice>
93: <choice computer="tries" nextstate="CHOOSE_TRIES">Set the <b>number of tries</b></choice>
94: <choice computer="weight" nextstate="CHOOSE_WEIGHT">Set the <b>problem weight</b></choice>
95: </choices>
96: </state>
97:
98: <state name="CHOOSE_WEIGHT" title="Set Problem Weight">
99: <eval>return 'What weight should be set for ' .
100: &{$helper->{DATA}->{'levelType'}}()
101: . '?<br />';
102: </eval>
103: <string nextstate="CHOOSE_STUDENT_LEVEL" variable="WEIGHT">
104: <validator>if ($val !~ /^[1234567890]+(\.[1234567890]+)?$/) {
105: return &mt('" [_1] " is not an acceptable weight. Weight must be a positive number.',$element->getValue());
106: }
107: return undef;
108: </validator>
109: </string>
110: </state>
111:
112: <state name="CHOOSE_TRIES" title="Set Problem Tries">
113: <eval>return 'How many tries should be set for ' .
114: &{$helper->{DATA}->{'levelType'}}()
115: . '?<br />';
116: </eval>
117: <string nextstate="CHOOSE_STUDENT_LEVEL" variable="TRIES">
118: <validator>if ($val !~ /^[1234567890]+$/) {
119: return &mt('" [_1] " is not an acceptable number of tries. Tries must be a positive number with no decimal point.',$element->getValue());}
120: return undef;
121: </validator>
122: </string>
123: </state>
124:
125: <state name="CHOOSE_DATE" title="Set Date">
126: <eval>
127: return 'What should the ' .
128: &{$helper->{DATA}->{'dateType'}}() .
129: ' be set to? <br /><br />';
130: </eval>
131: <date variable="PARM_DATE" hoursminutes='1'>
132: <nextstate>CHOOSE_STUDENT_LEVEL</nextstate>
133: </date>
134: </state>
135:
136: <state name="CHOOSE_STUDENT_LEVEL" title="Students Affected">
137: <eval>
138: return 'Set ' .
139: &{$helper->{DATA}->{'dateType'}}() .
140: ' for ' .
141: &{$helper->{DATA}->{'levelType'}}() .
142: ' for ...';
143: </eval>
144: <choices variable="TARGETS">
145: <choice computer="course" nextstate="FINISH">
146: . . . for <b>all students</b> in the course</choice>
147: <choice computer="section" nextstate="CHOOSE_SECTION">
148: . . . for a particular <b>section</b></choice>
149: <choice computer="student" nextstate="CHOOSE_STUDENT">
150: . . . for an individual <b>student</b></choice>
151: </choices>
152: </state>
153:
154: <state name="CHOOSE_SECTION" title="Select Section">
155: <eval>
156: return 'Please select the section you wish to set the ' .
157: &{$helper->{DATA}->{'dateType'}}() .
158: ' for:<br />';</eval>
159: <section variable="SECTION_NAME" nextstate="FINISH" />
160: </state>
161:
162: <state name="CHOOSE_STUDENT" title="Select Student">
163: <eval>
164: return 'Please select the student you wish to set the ' .
165: &{$helper->{DATA}->{'dateType'}}() .
166: ' for:<br />';</eval>
167: <student variable="USER_NAME" nextstate="FINISH" coursepersonnel='1'/>
168: </state>
169:
170: <state name="FINISH" title="Verify Selection">
171: <parmwizfinal />
172: </state>
173:
174: </helper>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>