1: <helper title="Course Initialization Helper" requiredpriv='opa'>
2:
3: <exec>
4: my $courseid = $env{'request.course.id'};
5: my $crsdom = $env{'course.'.$courseid.'.domain'};
6: my $crsnum = $env{'course.'.$courseid.'.num'};
7: $helper->{DATA}->{DOM} = $crsdom;
8: $helper->{DATA}->{CRS} = $crsnum;
9:
10: $helper->{DATA}->{FIRST_RUN} = $env{'course.'.$crsnum.
11: '.course.intialization.not.run'};
12: # Delete the 'course.initialization.not.run' course environment
13: Apache::lonnet::put('environment', {'course.helper.not.run' => 0},
14: $crsdom, $crsnum);
15: Apache::lonnet::coursedescription($env{'request.course.id'});
16:
17: $helper->{DATA}->{GETVAL} = sub {
18: my @resultlist = &Apache::lonnet::get('environment', [shift()],
19: $helper->{DATA}->{DOM},
20: $helper->{DATA}->{CRS});
21: return $resultlist[1]; };
22: $helper->{DATA}->{SETVAL} = sub {
23: my $name = shift;
24: my $val = shift;
25: if (&{$helper->{DATA}->{GETVAL}}($name) ne $val) {
26: &Apache::lonnet::put('environment', {$name=>$val},
27: $helper->{DATA}->{DOM},
28: $helper->{DATA}->{CRS});
29: # Try to fix bug 1757
30: Apache::lonnet::coursedescription($env{'request.course.id'});
31: return 1;
32: } else {
33: return 0;
34: }
35: }
36: </exec>
37:
38: <state name="START" title="Welcome to Your New LON-CAPA Course">
39: <eval>
40: return $helper->{DATA}->{FIRST_RUN} ?
41: 'This Helper will set up your new LON-CAPA course and choose '.
42: 'which features will be active. You can '.
43: 're-visit it later to change settings in your course.' .
44:
45: '<p>If you have previous experience with coordinating LON-CAPA courses and '.
46: 'prefer not to use the helper, <a href="/adm/menu">click here</a> to leave.'
47: :
48: &mt('This helper will set up your LON-CAPA course and choose which features will be active.');
49: </eval>
50: <message nextstate="COURSE_DESCRIPTION">
51: <p>All settings which you can change with this Helper can also be changed
52: by going to the "Modify parameter settings" screen and clicking on the "Course Configuration" button.</p>
53:
54: <p>If you do not have experience coordinating LON-CAPA courses or if you
55: prefer the Helper interface, please click "Next".</p>
56: </message>
57: </state>
58:
59: <state name="COURSE_DESCRIPTION" title="Course Title">
60: <message nextstate="FORBID_CHAT">
61: The "Course Title" is the name of the course that will be
62: seen by the students. You may now modify the description and hit
63: "Next" to continue.<br />
64: </message>
65: <string variable='description' size='60' >
66: <defaultvalue>
67: return &{$helper->{DATA}->{GETVAL}}('description');
68: </defaultvalue>
69: <finalcode>
70: if (&{$helper->{DATA}->{SETVAL}}('description', $element->getValue())) {
71: return 'Course description changed to <b>' . $element->getValue() .
72: '</b>.';
73: }
74: </finalcode>
75: </string>
76: </state>
77:
78: <state name="FORBID_CHAT" title="Chat Room Participation">
79: <message nextstate="FORBID_DISCUSSION">
80: <p>LON-CAPA has chat room functionality. This course will receive
81: its own chat room. You may deny students, TAs, or instructors
82: the right to access the chat room.</p>
83: </message>
84: <choices variable="BANNED_CHAT_ROLES" multichoice="1" allowempty='1'>
85: <choice computer="st"><b>Students</b> - students will not be able to use or view the chat room.</choice>
86: <choice computer="ta"><b>Teaching Assistants</b> - teaching assistants will not be able use or view the chat room</choice>
87: <choice computer="in"><b>Instructor</b> - instructors will not be able to use or view the chat room</choice>
88: <defaultvalue>
89: my $denied = &{$helper->{DATA}->{GETVAL}}('plc.roles.denied');
90: $denied =~ s/,/\|\|\|/g;
91: return $denied;
92: </defaultvalue>
93: <finalcode>
94: my $denied = $element->getValue();
95: $denied =~ s/\|\|\|/,/g;
96: if (&{$helper->{DATA}->{SETVAL}}('plc.roles.denied', $denied)) {
97: $denied =~ s/st/ students/;
98: $denied =~ s/in/ instructors/;
99: $denied =~ s/ta/ teaching assistants/;
100: $denied =~ s/ep/ exam proctors/;
101: if ($denied =~ /^[^,]*,[^,]*$/) { # only one comma
102: $denied =~ s/,/ and/g;
103: } else { # add "and" to last comma
104: $denied =~ s/,([^,]*)$/, and\1/;
105: }
106: if ($denied) {
107: $denied = substr($denied, 1) . ' not allowed to participate in chat room.';
108: $denied = ucfirst($denied);
109: } else {
110: $denied = 'Everyone can participate in chat room.';
111: }
112: return $denied;
113: } else {
114: return '';
115: }
116: </finalcode>
117: </choices>
118: </state>
119:
120: <state name="FORBID_DISCUSSION" title="Discussion Participation">
121: <message nextstate="DISCUSSION_HTML">
122: LON-CAPA hosts discussions on all resources in a course. By default,
123: all users are allowed to participate in these discussions.
124:
125: <p>If you do not wish certain types of users to be able to use the
126: discussion features, select those types below. Note your class
127: may not have all of these roles; you may safely ignore roles you
128: do not intend to use. (For instance, "Exam Proctor" is
129: generally useful only for large courses.)</p>
130:
131: <p>Types of users not allowed to participate in discussion can
132: still view any discussion that other users post.</p>
133:
134: </message>
135: <choices variable="BANNED_DISCUSSION_ROLES" multichoice="1" allowempty='1'>
136: <choice computer="st"><b>Students</b> - students will not be able to participate in discussions</choice>
137: <choice computer="ta"><b>Teaching Assistants</b> - teaching assistants will not be able to participate in discussions</choice>
138: <choice computer="in"><b>Instructor</b> - instructors will not be able to participate in discussions</choice>
139: <defaultvalue>
140: my $denied = &{$helper->{DATA}->{GETVAL}}('pch.roles.denied');
141: $denied =~ s/,/\|\|\|/g;
142: return $denied;
143: </defaultvalue>
144: <finalcode>
145: my $denied = $element->getValue();
146: $denied =~ s/\|\|\|/,/g;
147: if (&{$helper->{DATA}->{SETVAL}}('pch.roles.denied', $denied)) {
148: $denied =~ s/st/ students/;
149: $denied =~ s/in/ instructors/;
150: $denied =~ s/ta/ teaching assistants/;
151: $denied =~ s/ep/ exam proctors/;
152: if ($denied =~ /^[^,]*,[^,]*$/) { # only one comma
153: $denied =~ s/,/ and/g;
154: } else { # add "and" to last comma
155: $denied =~ s/,([^,]*)$/, and\1/;
156: }
157: if ($denied) {
158: $denied = substr($denied, 1) . ' not allowed to participate in discussion.';
159: $denied = ucfirst($denied);
160: } else {
161: $denied = 'Everyone can participate in discussion.';
162: }
163: return $denied;
164: } else {
165: return '';
166: }
167: </finalcode>
168: </choices>
169: </state>
170:
171: <state name="DISCUSSION_HTML" title="HTML in Discussions">
172: <message nextstate="FEEDBACK_ADDRESSES">
173: <p>HTML can be allowed or banned inside of course discussion.</p>
174: </message>
175: <choices variable="HTML_ALLOWED">
176: <choice computer=""><b>HTML banned</b>: HTML will not be allowed in discussion postings.</choice>
177: <choice computer="yes"><b>HTML allowed</b>: Discussion participants can use limited HTML in their postings.</choice>
178: <defaultvalue>
179: return &{$helper->{DATA}->{GETVAL}}('allow_limited_html_in_feedback');
180: </defaultvalue>
181: <finalcode>
182: if (&{$helper->{DATA}->{SETVAL}}('allow_limited_html_in_feedback', $element->getValue())) {
183: if ($element->getValue() eq 'yes') {
184: return 'Limited HTML allowed in feedback.';
185: } else {
186: return 'HTML not allowed in feedback.';
187: }
188: }
189: </finalcode>
190: </choices>
191: </state>
192:
193: <state name="FEEDBACK_ADDRESSES" title="Feedback Addresses for Course Content">
194: <message nextstate="USERS_ALLOWED_TO_CLONE">
195: Course members can provide feedback about the course. You can choose
196: who will receive the feedback, such as a different instructor or a
197: TA. Please enter their LON-CAPA address below, in the
198: form <b>user:domain</b>, where "user" and "domain"
199: are both the LON-CAPA username and LON-CAPA domain, not an e-mail
200: address.</p>
201: </message>
202: <eval>return '<p>'.&mt('Your current LON-CAPA domain is [_1].','"<b>'.$helper->{DATA}->{DOM}.'</b>"').'</p>';
203: </eval>
204: <string variable='feedback_addresses' size='60' >
205: <defaultvalue>
206: return &{$helper->{DATA}->{GETVAL}}('comment.email');
207: </defaultvalue>
208: <finalcode>
209: if (&{$helper->{DATA}->{SETVAL}}('comment.email', $element->getValue())) {
210: return 'Comment address(es) updated to <b>' . $element->getValue() .
211: '</b>.';
212: }
213: </finalcode>
214: </string>
215: <message>
216: <p><b>Advanced</b>: You can send the feedback from different sections
217: to different people, by doing the following:</p>
218:
219: <ul><li>Separate each entry with a comma.</li>
220: <li>To send feedback to a certain address for different sections,
221: append the section name or names (separated by semi-colons)
222: in a parenthesized list after the <b>user:domain</b>.</li></ul>
223:
224: <p>For example,</p>
225:
226: <p><b>john102:msu(001;002;003),bob293:msu(004;005;006),madeupname:here(007;008;009)</b></p>
227:
228: <p>will route course feedback to "john102" for sections 1, 2, and 3, to
229: "bob293" for 4, 5, and 6, and to "madeupname:here" for
230: 7, 8, and 9. Note there is no requirement that the addresses be in any
231: particular domain.</p>
232: </message>
233: </state>
234:
235: <state name="USERS_ALLOWED_TO_CLONE" title="Granting permission to clone course">
236: <message nextstate="FINAL">
237: Existing courses can be cloned when creating new courses.<br />
238: Cloning will copy the course structure, contents, and most parameters (automatically advancing any date parameters by six months).<br /><br />
239: Usernames of owners of other courses permitted to clone this course:<br />
240: </message>
241: <string variable='can_clone' size='60' >
242: <defaultvalue>
243: return &{$helper->{DATA}->{GETVAL}}('cloners');
244: </defaultvalue>
245: <validator>
246: my ($output,@cloners,%disallowed);
247: my $match_dom = $LONCAPA::match_domain;
248: my $match_uname = $LONCAPA::match_username;
249: if ($val =~ /,/) {
250: @cloners = split(/,/,$val);
251: } else {
252: $cloners[0] = $val;
253: }
254: foreach my $item (@cloners) {
255: next if ($item =~ /^\s*$/);
256: next if ($item eq '*');
257:
258: my ($clname,$cldom) = split(/:/,$item);
259: if ($clname eq '*') {
260: if ($cldom =~ /^$match_dom$/) {
261: if (!&Apache::lonnet::domain($cldom)) {
262: $disallowed{'domain'} .= $item.',';
263: }
264: } else {
265: $disallowed{'format'} .= $item.',';
266: }
267: } elsif ($item !~/^($match_uname)\:($match_dom)$/) {
268: $disallowed{'format'} .= $item.',';
269: } else {
270: if (!&Apache::lonnet::domain($cldom)) {
271: $disallowed{'domain'} .= $item.',';
272: } elsif (&Apache::lonnet::homeserver($clname,$cldom) eq 'no_host') {
273: $disallowed{'newuser'} .= $item.',';
274: }
275: }
276: }
277: foreach my $key (keys(%disallowed)) {
278: $disallowed{$key} =~ s/,$//;
279: }
280: if (keys(%disallowed) > 0) {
281: $output.= 'Your input contained the following errors:<ul>';
282: if (defined($disallowed{'format'})) {
283: $output .= '<li>Invalid format: '.
284: '<b>'.$disallowed{'format'}.'</b></li>';
285: }
286: if (defined($disallowed{'domain'})) {
287: $output .= '<li>Domain(s) do(es) not exist: '.
288: '<b>'.$disallowed{'domain'}.'</b></li>';
289: }
290: if (defined($disallowed{'newuser'})) {
291: $output .= '<li>LON-CAPA user(s) do(es) not exist: '.
292: '<b>'.$disallowed{'newuser'}.'</b></li>';
293: }
294: $output .= '</ul>';
295: }
296: return $output;
297: </validator>
298: <finalcode>
299: if (&{$helper->{DATA}->{SETVAL}}('cloners', $element->getValue())) {
300:
301:
302: return 'Users allowed to clone course updated to <b>' . $element->getValue() .
303: '</b>.';
304: }
305: </finalcode>
306: </string>
307: <message>
308: <br />(Course Coordinators automatically have the right to clone their own courses.)
309: <ul>
310: <li>Format: <b>user:domain</b>, where "user" and "domain"
311: are the LON-CAPA username and domain of the user.</li>
312: <li>Separate different users with a comma.</li>
313: <li>Use *:domain to allow course to be cloned by any course owner in the specified domain.</li>
314: <li>Use * to allow unrestricted cloning by all course owners in all domains.</li>
315: </ul>
316: </message>
317: </state>
318: <state name="FINAL" title="Completed">
319: <message>Your course is now set up. Please select the <b>Save</b>
320: button to re-intialize the course with your chosen
321: settings.
322:
323: <p>Remember that all of these settings can be modified in the <b>Modify parameter settings</b>
324: screen (<b>Course Configuration</b>).</p>
325: </message>
326: <condition>
327: <clause>$env{'course.'.$env{'request.course.id'}.'.clonedfrom'}</clause>
328: <message>After you select <b>Finish Course Initialization</b>,
329: you will be taken to the Parameter Overview screen to
330: update the dates for this cloned course.</message>
331: </condition>
332: <final restartCourse='1' />
333: </state>
334: </helper>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>