1: <helper title="Course Parameter Helper" requiredpriv='opa&S'>
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:
30: <p>This helper will assist you in <b>setting the open, due,
31: and answer dates</b> for problems, <b>setting the problem
32: weights</b>, or in <b>setting the number of tries</b> for
33: problems.</p>
34:
35: <p>You will be asked to <b>select which problems</b> you wish to
36: set the parameters for, then <b>what parameter</b> you
37: wish to set, then you will select <b>whom the setting
38: affects</b>.</p>
39:
40: <p>After the helper is done, you will be shown where in
41: the advanced interface you would have gone to set
42: the parameter you have chosen, so in the future you
43: can do it directly.</p>
44:
45: <p>Press <b>Next -></b> to begin, or select <b><-
46: Previous</b> to go back to the previous screen.</p>
47: </message>
48: </state>
49:
50: <state name="CHOOSE_LEVEL" title="Which Problem or Problems?">
51: <message>Which problems do you wish to set a parameter for?</message>
52: <choices variable="GRANULARITY">
53: <choice computer="whole_course" nextstate="CHOOSE_ACTION">
54: Course default for all problems
55: </choice>
56: <condition>
57: <clause>return 1 if (&Apache::lonnet::get_server_loncaparev($env{'course.'.$env{'request.course.id'}.'.home'}) >= 2.12)</clause>
58: <choice computer="maprecurse" nextstate="CHOOSE_FOLDER">
59: Every problem in a particular folder and (recursively) for sub-folders
60: (overrides course default)
61: </choice>
62: <condition>
63: <choice computer="map" nextstate="CHOOSE_FOLDER">
64: Every problem in a particular folder (overrides course default)
65: </choice>
66: <choice computer="resource" nextstate="CHOOSE_RESOURCE">
67: One particular problem (overrides folder and course defaults)
68: </choice>
69: </choices>
70: </state>
71:
72: <state name="CHOOSE_FOLDER" title="Select Folder">
73: <message>Select the folder you wish to set the parameter for:</message>
74:
75: <resource variable="RESOURCE_ID">
76: <nextstate>CHOOSE_ACTION</nextstate>
77: <filterfunc>return $res->is_map()</filterfunc>
78: <valuefunc>return $res->map_pc();</valuefunc>
79: </resource>
80: </state>
81:
82: <state name="CHOOSE_RESOURCE" title="Select Problem">
83: <message>Select the problem you wish to set the parameter for:</message>
84:
85: <resource variable="RESOURCE_ID" nextstate="CHOOSE_ACTION" addparts="true">
86: <nextstate>CHOOSE_ACTION</nextstate>
87: <filterfunc>return $res->is_map || $res->is_problem()</filterfunc>
88: <choicefunc>return $res->is_problem()</choicefunc>
89: </resource>
90: </state>
91:
92: <state name="CHOOSE_ACTION" title="Parameter Type">
93: <eval>return &mt('What parameter do you want to set for ' .
94: &{$helper->{DATA}->{'levelType'}}()
95: . '?');
96: </eval>
97: <choices variable="ACTION_TYPE">
98: <nextstate>CHOOSE_DATE</nextstate>
99: <choice computer="open_date" nextstate="CHOOSE_DATE">Set an <b>open date</b></choice>
100: <choice computer="due_date" nextstate="CHOOSE_DATE">Set a <b>due date</b></choice>
101: <choice computer="answer_date" nextstate="CHOOSE_DATE">Set an <b>answer open date</b></choice>
102: <choice computer="tries" nextstate="CHOOSE_TRIES">Set the <b>number of tries</b></choice>
103: <choice computer="weight" nextstate="CHOOSE_WEIGHT">Set the <b>problem weight</b></choice>
104: </choices>
105: </state>
106:
107: <state name="CHOOSE_WEIGHT" title="Set Problem Weight">
108: <eval>return &mt('What weight should be set for ' .
109: &{$helper->{DATA}->{'levelType'}}()
110: . '?').'<br />';
111: </eval>
112: <string nextstate="CHOOSE_STUDENT_LEVEL" variable="WEIGHT">
113: <validator>if ($val !~ /^[1234567890]+(\.[1234567890]+)?$/) {
114: return &mt('[_1] is not an acceptable weight. Weight must be a positive number.','"'.$element->getValue().'"');
115: }
116: return undef;
117: </validator>
118: </string>
119: </state>
120:
121: <state name="CHOOSE_TRIES" title="Set Problem Tries">
122: <eval>return &mt('How many tries should be set for ' .
123: &{$helper->{DATA}->{'levelType'}}()
124: . '?').'<br />';
125: </eval>
126: <string nextstate="CHOOSE_STUDENT_LEVEL" variable="TRIES">
127: <validator>if ($val !~ /^[1234567890]+$/) {
128: return &mt('[_1] is not an acceptable number of tries. Tries must be a positive number with no decimal point.','"'.$element->getValue().'"');}
129: return undef;
130: </validator>
131: </string>
132: </state>
133:
134: <state name="CHOOSE_DATE" title="Set Date">
135: <eval>
136: return &mt('What should the ' .
137: &{$helper->{DATA}->{'dateType'}}() .
138: ' be set to?').'<br /><br />';
139: </eval>
140: <date variable="PARM_DATE" hoursminutes='1'>
141: <nextstate>CHOOSE_STUDENT_LEVEL</nextstate>
142: </date>
143: </state>
144:
145: <state name="CHOOSE_STUDENT_LEVEL" title="Students Affected">
146: <eval>
147: return &mt('Set ' .
148: &{$helper->{DATA}->{'dateType'}}() .
149: ' for ' .
150: &{$helper->{DATA}->{'levelType'}}() .
151: ' for ...');
152: </eval>
153: <choices variable="TARGETS">
154: <condition>
155: <clause>return 1 if ($env{'request.course.sec'} eq '')</clause>
156: <choice computer="course" nextstate="FINISH">
157: . . . for <b>all students</b> in the course</choice>
158: </condition>
159: <choice computer="section" nextstate="CHOOSE_SECTION">
160: . . . for a particular <b>section</b></choice>
161: <condition>
162: <clause>return 1 if (($env{'request.course.groups'} ne '') || (&Apache::lonnet::allowed('mdg',$env{'request.course.id'}) && (&Apache::longroup::coursegroups())))</clause>
163: <choice computer="group" nextstate="CHOOSE_GROUP">
164: . . . for a particular <b>group</b></choice>
165: </condition>
166: <choice computer="student" nextstate="CHOOSE_STUDENT">
167: . . . for an individual <b>student</b> or <b>user</b></choice>
168: </choices>
169: </state>
170:
171: <state name="CHOOSE_SECTION" title="Select Section">
172: <eval>
173: return &mt('Please select the section you wish to set the ' .
174: &{$helper->{DATA}->{'dateType'}}() .
175: ' for:').'<br />';</eval>
176: <section variable="SECTION_NAME" nextstate="FINISH" onlysections="1" />
177: </state>
178:
179: <state name="CHOOSE_GROUP" title="Select Group">
180: <eval>
181: return &mt('Please select the group you wish to set the ' .
182: &{$helper->{DATA}->{'dateType'}}() .
183: ' for:').'<br />';</eval>
184: <group variable="GROUP_NAME" nextstate="FINISH" grouponly="1" />
185: </state>
186:
187:
188: <state name="CHOOSE_STUDENT" title="Select User">
189: <eval>
190: return &mt('Please select the person you wish to set the ' .
191: &{$helper->{DATA}->{'dateType'}}() .
192: ' for:').'<br />';</eval>
193: <student variable="USER_NAME" nextstate="FINISH" coursepersonnel="1" sectiononly="1" />
194: </state>
195:
196: <state name="FINISH" title="Verify Selection">
197: <parmwizfinal />
198: </state>
199:
200: </helper>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>