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