Annotation of loncom/interface/loncreatecourse.pm, revision 1.162
1.65 raeburn 1: # The LearningOnline Network
1.1 www 2: # Create a course
1.5 albertel 3: #
1.162 ! raeburn 4: # $Id: loncreatecourse.pm,v 1.161 2016/04/06 17:41:52 raeburn Exp $
1.5 albertel 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
1.48 www 28: ###
29:
1.111 jms 30: =head1 NAME
31:
32: Apache::loncreatecourse.pm
33:
34: =head1 SYNOPSIS
35:
36: Allows domain coordinators to create new
37: courses and assign course coordinators.
38:
39: This is part of the LearningOnline Network with CAPA project
40: described at http://www.lon-capa.org.
41:
1.112 jms 42: =head1 SUBROUTINES
1.111 jms 43:
44: =over
45:
1.112 jms 46: =item handler()
1.111 jms 47:
1.112 jms 48: =item print_course_creation_page()
1.111 jms 49:
1.112 jms 50: =item create_course()
1.111 jms 51:
1.112 jms 52: =item print_intro_page()
1.111 jms 53:
1.112 jms 54: =item upload_batchfile()
1.111 jms 55:
1.112 jms 56: =item process_batchfile()
1.111 jms 57:
1.127 raeburn 58: =item courserequestbrowser_javascript()
59:
60: =item print_creation_logs()
61:
62: =item creation_display_filter()
63:
64: =item context_names()
65:
66: =item instcode_srchstr()
67:
68: =item syllabuslink_javascript()
69:
1.111 jms 70: =back
71:
72: =cut
73:
1.1 www 74: package Apache::loncreatecourse;
75:
76: use strict;
77: use Apache::Constants qw(:common :http);
78: use Apache::lonnet;
1.12 www 79: use Apache::loncommon;
1.13 www 80: use Apache::londocs;
1.38 www 81: use Apache::lonlocal;
1.105 raeburn 82: use Apache::lonuserutils;
1.96 albertel 83: use Apache::lonclonecourse;
1.90 raeburn 84: use LONCAPA::batchcreatecourse;
1.89 www 85: use LONCAPA;
1.28 www 86:
1.2 www 87: # ===================================================== Phase one: fill-in form
88:
1.10 matthew 89: sub print_course_creation_page {
1.2 www 90: my $r=shift;
1.123 raeburn 91: my $crstype = 'Community';
1.90 raeburn 92: if ($env{'form.phase'} eq 'courseone') {
93: $crstype = 'Course';
1.159 raeburn 94: } elsif ($env{'form.phase'} eq 'placementone') {
95: $crstype = 'Placement';
1.90 raeburn 96: }
1.78 albertel 97: my $defdom=$env{'request.role.domain'};
1.147 raeburn 98: my %domdefaults = &Apache::lonnet::get_domain_defaults($defdom);
1.101 albertel 99: my %host_servers = &Apache::lonnet::get_servers($defdom,'library');
1.10 matthew 100: my $course_home = '<select name="course_home" size="1">'."\n";
101: foreach my $server (sort(keys(%host_servers))) {
1.14 matthew 102: $course_home .= qq{<option value="$server"};
103: if ($server eq $Apache::lonnet::perlvar{'lonHostID'}) {
104: $course_home .= " selected ";
105: }
106: $course_home .= qq{>$server $host_servers{$server}</option>};
1.10 matthew 107: }
108: $course_home .= "\n</select>\n";
1.9 matthew 109: my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');
1.32 www 110: my $cloneform=&Apache::loncommon::select_dom_form
1.78 albertel 111: ($env{'request.role.domain'},'clonedomain').
1.32 www 112: &Apache::loncommon::selectcourse_link
1.90 raeburn 113: ('ccrs','clonecourse','clonedomain',undef,undef,undef,$crstype);
1.78 albertel 114: my $coursebrowserjs=&Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'});
1.134 raeburn 115: my ($enroll_table,$krbdef,$krbdefdom,$krbform,$intform,$locform,
1.90 raeburn 116: $javascript_validations);
1.134 raeburn 117: my $starttime = time;
118: my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
119: my $access_table = &Apache::lonuserutils::date_setting_table($starttime,
120: $endtime,'create_defaultdates');
1.162 ! raeburn 121: if (($crstype eq 'Course') || ($crstype eq 'Placement')) {
1.105 raeburn 122: $enroll_table = &Apache::lonuserutils::date_setting_table($starttime,
123: $endtime,'create_enrolldates');
1.90 raeburn 124: ($krbdef,$krbdefdom) =
125: &Apache::loncommon::get_kerberos_defaults($defdom);
1.105 raeburn 126: $javascript_validations=&Apache::lonuserutils::javascript_validations(
1.90 raeburn 127: 'createcourse',$krbdefdom);
128: my %param = ( formname => 'document.ccrs',
129: kerb_def_dom => $krbdefdom,
130: kerb_def_auth => $krbdef
131: );
132: $krbform = &Apache::loncommon::authform_kerberos(%param);
133: $intform = &Apache::loncommon::authform_internal(%param);
134: $locform = &Apache::loncommon::authform_local(%param);
1.162 ! raeburn 135: } else {
1.123 raeburn 136: my $title_alert = &mt('A Community title is required');
137: my $coord_alert = &mt('The username of the Coordinator is required');
1.158 damieng 138: &js_escape(\$title_alert);
139: &js_escape(\$coord_alert);
1.90 raeburn 140: $javascript_validations = qq|
141: function validate(formname) {
142: if (formname.title == '') {
1.123 raeburn 143: alert("$title_alert");
1.90 raeburn 144: return;
145: }
146: if (formname.ccuname == '') {
1.123 raeburn 147: alert("$coord_alert");
1.90 raeburn 148: }
149: formname.submit();
150: }
151: |;
152: }
1.46 sakharuk 153: my %lt=&Apache::lonlocal::texthash(
154: 'cinf' => "Course Information",
155: 'ctit' => "Course Title",
156: 'chsr' => "Course Home Server",
157: 'cidn' => "Course ID/Number",
158: 'opt' => "optional",
159: 'iinf' => "Institutional Information",
160: 'stat' => "The following entries will be used to identify the course according to the naming scheme adopted by your institution. Your choices will be used to map an internal LON-CAPA course ID to the corresponding course section ID(s) used by the office responsible for providing official class lists for courses at your institution. This mapping is required if you choose to employ automatic population of class lists.",
161: 'ccod' => "Course Code",
1.90 raeburn 162: 'snid' => "Section Numbers and corresponding LON-CAPA section IDs",
163: 'csli' => "a comma separated list of institutional section numbers, each separated by a colon from the (optional) corresponding section ID to be used in LON-CAPA e.g., 001:1,002:2",
1.46 sakharuk 164: 'crcs' => "Crosslisted courses",
1.157 bisitz 165: 'cscs' => "a comma separated list of course sections crosslisted with the current course, with each entry including the institutional course section name followed by a colon and then the (optional) section ID to be used in LON-CAPA, e.g., fs03ent231001:ent1,fs03bot231001:bot1,fs03zol231002:zol2",
1.147 raeburn 166: 'ccre' => "Course credits",
1.154 bisitz 167: 'crcd' => "Create six character course identifier to share with students",
1.147 raeburn 168: 'cred' => "the number of institutional credits students will earn by completing this course",
1.46 sakharuk 169: 'crco' => "Course Content",
170: 'cncr' => "Completely new course",
171: 'cecr' => "Clone an existing course",
172: 'map' => "Map",
173: 'smap' => "Select Map",
174: 'sacr' => "Do NOT generate as standard course",
175: 'ocik' => "only check if you know what you are doing",
176: 'fres' => "First Resource",
177: 'stco' => "standard courses only",
178: 'blnk' => "Blank",
179: 'sllb' => "Syllabus",
1.132 raeburn 180: 'navi' => "Course Contents",
1.46 sakharuk 181: 'cid' => "Course ID",
182: 'dmn' => "Domain",
1.110 bisitz 183: 'dsh' => "Date Shift",
1.46 sakharuk 184: 'asov' => "Additional settings, if specified below, will override cloned settings",
1.106 www 185: 'ncd' => "Do not clone date parameters",
186: 'prd' => 'Clone date parameters as-is',
187: 'shd' => 'Shift date parameters by number of days',
1.46 sakharuk 188: 'assp' => "Assessment Parameters",
189: 'oaas' => "Open all assessments",
190: 'mssg' => "Messaging",
191: 'scpf' => "Set course policy feedback to Course Coordinator",
192: 'scfc' => "Set content feedback to Course Coordinator",
193: 'cmmn' => "Communication",
194: 'dsrd' => "Disable student resource discussion",
1.117 hauer 195: 'dsuc' => "Disable student use of chat rooms",
1.46 sakharuk 196: 'acco' => "Access Control",
197: 'snak' => "Students need access key to enter course",
1.124 raeburn 198: 'ow' => "Course Owner",
199: 'cc' => "(will be assigned Course Coordinator role)",
1.46 sakharuk 200: 'user' => "Username",
201: 'aens' => "Automated enrollment settings",
202: 'aesc' => "The following settings control automatic enrollment of students in this class based on information available for this specific course from your institution's official classlists.",
203: 'aadd' => "Automated adds",
204: 'yes' => "Yes",
205: 'no' => "No",
206: 'audr' => "Automated drops",
207: 'dacu' => "Duration of automated classlist updates",
1.119 bisitz 208: 'dads' => 'Default Access Dates for Students',
1.60 raeburn 209: 'dacc' => "Default start and end dates for student access",
1.134 raeburn 210: 'psam' => "Authentication mechanism",
211: 'pcda' => "Default authentication method for new users added to this domain by the automated enrollment process",
1.46 sakharuk 212: 'nech' => "Notification of enrollment changes",
213: 'irsp' => "Include retrieval of student photographs?",
1.55 www 214: 'rshm' => 'Resource Space Home',
1.93 raeburn 215: 'cgrs' => "Course Group Settings",
1.119 bisitz 216: 'cgrq' => 'Set a quota for the total disk space available for storage of course group portfolio files',
1.133 raeburn 217: 'opco' => 'Open Course',
218: 'opcm' => 'Open Community',
1.161 raeburn 219: 'oppt' => 'Open Placement Test',
1.133 raeburn 220: );
221: $lt{'kaut'} = &mt('Key authority ([_1]id:domain[_2]) if other than course','<tt>','</tt>');
1.150 bisitz 222: $lt{'toin'} = &mt('to interface with institutional data, e.g., [_1]fs13glg231[_2] for [_3]Fall 2013 Geology 231[_4]','<tt>','</tt>','<i>','</i>');
223: $lt{'nccl'} = &mt('Notification to [_1]course coordinator[_2] via LON-CAPA message when enrollment changes occur during the automated update?','<b>','</b>');
224: $lt{'ndcl'} = &mt('Notification to [_1]domain coordinator[_2] via LON-CAPA message when enrollment changes occur during the automated update?','<b>','</b>');
1.133 raeburn 225:
226: if ($crstype eq 'Community') {
227: $lt{'cinf'} = &mt('Community Information');
228: $lt{'ctit'} = &mt('Community Title');
229: $lt{'chsr'} = &mt('Community Home Server');
230: $lt{'cidn'} = &mt('Community ID/Number');
231: $lt{'crco'} = &mt('Community Content');
232: $lt{'cncr'} = &mt('Completely new community');
233: $lt{'cecr'} = &mt('Clone an existing community');
234: $lt{'sacr'} = &mt('Do NOT generate as standard community');
235: $lt{'stco'} = &mt('standard communities only');
236: $lt{'navi'} = &mt('Community Contents');
237: $lt{'cid'} = &mt('Community ID');
238: $lt{'scpf'} = &mt('Set community policy feedback to Coordinator');
239: $lt{'scfc'} = &mt('Set content feedback to Coordinator');
240: $lt{'dsrd'} = &mt('Disable member resource discussion');
241: $lt{'dsuc'} = &mt('Disable member use of chat rooms');
242: $lt{'dads'} = &mt('Default Access Dates for Members');
243: $lt{'dacc'} = &mt('Default start and end dates for member access');
244: $lt{'snak'} = &mt('Members need access key to enter course');
245: $lt{'kaut'} = &mt('Key authority ([_1]id:domain[_2]) if other than community','<tt>','</tt>');
246: $lt{'ow'} = &mt('Community Owner');
247: $lt{'cc'} = &mt('(will be assigned Coordinator role)');
248: $lt{'cgrs'} = &mt('Community Group Settings');
249: $lt{'cgrq'} = &mt('Set a quota for the total disk space available for storage of community group portfolio files');
1.159 raeburn 250: } elsif ($crstype eq 'Placement') {
251: $lt{'cinf'} = &mt('Placement Test Information');
252: $lt{'ctit'} = &mt('Placement Test Title');
253: $lt{'chsr'} = &mt('Placement Test Home Server');
254: $lt{'cidn'} = &mt('Placement Test ID/Number');
255: $lt{'crco'} = &mt('Placement Test Content');
256: $lt{'cncr'} = &mt('Completely new placement test');
257: $lt{'cecr'} = &mt('Clone an existing placement test');
258: $lt{'sacr'} = &mt('Do NOT generate as standard placement test');
259: $lt{'stco'} = &mt('standard placement tests only');
260: $lt{'navi'} = &mt('Placement Test Contents');
261: $lt{'cid'} = &mt('Placement Test ID');
1.133 raeburn 262: }
1.86 albertel 263: my $js = <<END;
264: <script type="text/javascript">
1.6 matthew 265: var editbrowser = null;
266: function openbrowser(formname,elementname) {
267: var url = '/res/?';
268: if (editbrowser == null) {
269: url += 'launch=1&';
270: }
271: url += 'catalogmode=interactive&';
272: url += 'mode=edit&';
273: url += 'form=' + formname + '&';
1.7 matthew 274: url += 'element=' + elementname + '&';
275: url += 'only=sequence' + '';
1.6 matthew 276: var title = 'Browser';
277: var options = 'scrollbars=1,resizable=1,menubar=0';
278: options += ',width=700,height=600';
279: editbrowser = open(url,title,options,'1');
280: editbrowser.focus();
281: }
1.41 raeburn 282: $javascript_validations
1.6 matthew 283: </script>
1.32 www 284: $coursebrowserjs
1.86 albertel 285: END
286:
1.90 raeburn 287: my %titles = &Apache::lonlocal::texthash(
288: courseone => 'Create a New Course',
1.123 raeburn 289: groupone => 'Create a New Community',
1.159 raeburn 290: placementone=> 'Create a New Placement Test',
1.90 raeburn 291: );
1.86 albertel 292: my $start_page =
1.90 raeburn 293: &Apache::loncommon::start_page($titles{$env{'form.phase'}},$js);
1.86 albertel 294: my $end_page =
295: &Apache::loncommon::end_page();
1.91 albertel 296: my $crumbs =
297: &Apache::lonhtmlcommon::breadcrumbs($crstype.' Information',
298: 'Create_Course',undef,
299: 'Create_Courses');
1.90 raeburn 300: $r->print($start_page.$crumbs);
1.110 bisitz 301:
1.149 bisitz 302: $r->print('<form action="/adm/createcourse" method="post" name="ccrs" action=""><div class="LC_createcourse">'
1.133 raeburn 303: .&Apache::lonhtmlcommon::start_pick_box()
304:
305: .&Apache::lonhtmlcommon::row_headline()
306: .'<h3>'.$lt{'ow'}.' '.$lt{'cc'}.'</h3>'
307: .&Apache::lonhtmlcommon::row_closure()
308:
309: .&Apache::lonhtmlcommon::row_title($lt{'user'})
310: .'<input type="text" size="15" name="ccuname" />'
311: .&Apache::loncommon::studentbrowser_javascript()
312: .&Apache::loncommon::selectstudent_link('ccrs','ccuname','ccdomain')
313: .&Apache::lonhtmlcommon::row_closure()
314:
315: .&Apache::lonhtmlcommon::row_title($lt{'dmn'},"","LC_odd_row_value")
316: .$domform
317: .&Apache::lonhtmlcommon::row_closure()
318:
319: .&Apache::lonhtmlcommon::row_headline()
320: .'<h3>'.$lt{'cinf'}.'</h3>'
321: .&Apache::lonhtmlcommon::row_closure()
322:
323: .&Apache::lonhtmlcommon::row_title($lt{'ctit'})
1.145 www 324: .'<input type="text" size="80" name="title" />'
1.133 raeburn 325: .&Apache::lonhtmlcommon::row_closure()
326:
327: .&Apache::lonhtmlcommon::row_title($lt{'chsr'})
328: .$course_home
329: .&Apache::lonhtmlcommon::row_closure()
330:
331: .&Apache::lonhtmlcommon::row_title($lt{'cidn'}.' ('.$lt{'opt'}.')')
332: .'<input type="text" size="30" name="crsid" />'
333: .&Apache::lonhtmlcommon::row_closure()
334: );
1.161 raeburn 335: if (($crstype eq 'Course') || ($crstype eq 'Placement')) {
1.133 raeburn 336: $r->print(&Apache::lonhtmlcommon::row_headline()
1.109 bisitz 337: .'<h3>'.$lt{'iinf'}.'</h3>'
1.161 raeburn 338: .$lt{'stat'});
339: if ($crstype eq 'Course') {
340: $r->print(' '
341: .&mt('Default credits can also be specified, if different from the domain defaults (official courses: [_1]; unofficial courses: [_2]; textbook courses: [_3]).',
342: $domdefaults{'officialcredits'},$domdefaults{'unofficialcredits'},$domdefaults{'textbookcredits'}));
343: }
344: $r->print(&Apache::lonhtmlcommon::row_closure()
1.109 bisitz 345: .&Apache::lonhtmlcommon::row_title($lt{'ccod'})
346: .'<input type="text" size="30" name="crscode" />'
347: .'<br />('.$lt{'toin'}.')'
348: .&Apache::lonhtmlcommon::row_closure()
349:
350: .&Apache::lonhtmlcommon::row_title($lt{'snid'})
351: .'<input type="text" size="30" name="crssections" />'
352: .'<br />('.$lt{'csli'}.')'
353: .&Apache::lonhtmlcommon::row_closure()
354:
355: .&Apache::lonhtmlcommon::row_title($lt{'crcs'})
356: .'<input type="text" size="30" name="crsxlist" />'
357: .'<br />('.$lt{'cscs'}.')'
358: .&Apache::lonhtmlcommon::row_closure()
1.110 bisitz 359: );
1.161 raeburn 360: if (($crstype eq 'Course') && ($domdefaults{'officialcredits'} ||
361: $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'})) {
1.147 raeburn 362: $r->print(&Apache::lonhtmlcommon::row_title($lt{'ccre'})
363: .'<input type="text" size="3" name="defaultcredits" />'
364: .'<br />('.$lt{'cred'}.')'
365: .&Apache::lonhtmlcommon::row_closure()
366: );
367: }
1.153 raeburn 368: $r->print(&Apache::lonhtmlcommon::row_title($lt{'crcd'})
369: .'<span class="LC_nobreak">'
370: .'<input type="radio" name="uniquecode" value="1" />'.&mt('Yes').(' 'x2)
371: .'<input type="radio" name="uniquecode" value="0" checked="checked" />'.&mt('No')
372: .&Apache::lonhtmlcommon::row_closure()
1.159 raeburn 373: );
374: }
375: my $blankchk;
376: if ($crstype eq 'Placement') {
377: $blankchk = ' checked="checked"';
1.133 raeburn 378: }
379: # Table: New Course / Clone Course
380: $r->print(&Apache::lonhtmlcommon::row_headline()
1.109 bisitz 381: .'<h3>'.$lt{'crco'}.'</h3>'
1.110 bisitz 382: .&Apache::loncommon::start_data_table()
383: .&Apache::loncommon::start_data_table_header_row()
384: .'<th>'.$lt{'cncr'}.'</th>'
385: .'<th> '.&mt('or').' </th>'
386: .'<th>'.$lt{'cecr'}.'</th>'
387: .&Apache::loncommon::end_data_table_header_row()
388: .&Apache::loncommon::start_data_table_row()
389:
390: # New Course:
391: .'<td>'
392: .&Apache::lonhtmlcommon::start_pick_box()
393: .&Apache::lonhtmlcommon::row_title($lt{'map'})
394: .'<input type="text" size="50" name="topmap" />'
395: .'<a href="javascript:openbrowser(\'ccrs\',\'topmap\')">'.$lt{'smap'}.'</a>'
396: .&Apache::lonhtmlcommon::row_closure()
397: .&Apache::lonhtmlcommon::row_title('<label for="nonstd">'.$lt{'sacr'}.'</label>')
398: .'<input id="nonstd" type="checkbox" name="nonstandard" />'
399: .'<br />('.$lt{'ocik'}.')'
400: .&Apache::lonhtmlcommon::row_closure()
401: .&Apache::lonhtmlcommon::row_title($lt{'fres'})
402: .'<label>'
1.159 raeburn 403: .'<input type="radio" name="firstres" value="blank"'.$blankchk.' />'.$lt{'blnk'}
404: .'</label>');
1.139 raeburn 405: if ($crstype eq 'Community') {
1.159 raeburn 406: $r->print(' <label>'
1.139 raeburn 407: .'<input type="radio" name="firstres" value="nav" checked="checked" />'.$lt{'navi'}
408: .'</label>');
1.159 raeburn 409: } elsif ($crstype eq 'Course') {
410: $r->print(' <label>'
1.110 bisitz 411: .'<input type="radio" name="firstres" value="syl" checked="checked" />'.$lt{'sllb'}
412: .'</label>'
413: .' '
414: .'<label>'
415: .'<input type="radio" name="firstres" value="nav" />'.$lt{'navi'}
1.139 raeburn 416: .'</label>');
417: }
418: $r->print('<br />('.$lt{'stco'}.')'
1.110 bisitz 419: .&Apache::lonhtmlcommon::row_closure(1)
420: .&Apache::lonhtmlcommon::end_pick_box()
1.109 bisitz 421:
1.110 bisitz 422: .'<td> </td>'
1.109 bisitz 423:
1.110 bisitz 424: # Clone Course:
425: .'<td>'
426: .&Apache::lonhtmlcommon::start_pick_box()
427: .&Apache::lonhtmlcommon::row_title($lt{'cid'})
428: .'<label>'
429: .'<input type="text" size="25" name="clonecourse" value="" />'
430: .'</label>'
431: .&Apache::lonhtmlcommon::row_closure(1)
432: .&Apache::lonhtmlcommon::row_title($lt{'dmn'})
433: .'<label>'
434: .$cloneform
435: .'</label>'
436: .&Apache::lonhtmlcommon::row_closure()
437: .&Apache::lonhtmlcommon::row_title($lt{'dsh'})
438: .'<label>'
439: .'<input type="radio" name="datemode" value="delete" /> '.$lt{'ncd'}
440: .'</label><br />'
441: .'<label>'
442: .'<input type="radio" name="datemode" value="preserve" /> '.$lt{'prd'}
443: .'</label><br />'
444: .'<label>'
445: .'<input type="radio" name="datemode" value="shift" checked="checked" /> '.$lt{'shd'}
446: .'</label>'
447: .' <input type="text" size="5" name="dateshift" value="365" />'
448: .&Apache::lonhtmlcommon::row_closure()
449: .&Apache::lonhtmlcommon::row_headline()
1.146 bisitz 450: .'<span class="LC_info">'.$lt{'asov'}.'</span>'
1.110 bisitz 451: .&Apache::lonhtmlcommon::row_closure(1)
452: .&Apache::lonhtmlcommon::end_pick_box()
453: .'</td>'
454: .&Apache::loncommon::end_data_table_row()
455: .&Apache::loncommon::end_data_table()
1.109 bisitz 456: .&Apache::lonhtmlcommon::row_closure()
1.133 raeburn 457: );
1.109 bisitz 458:
1.133 raeburn 459: $r->print(&Apache::lonhtmlcommon::row_headline()
1.119 bisitz 460: .'<h3>'.$lt{'dads'}.'</h3>'
461: .&Apache::lonhtmlcommon::row_closure()
462: .&Apache::lonhtmlcommon::row_title($lt{'dacc'})
463: .$access_table
464: .&Apache::lonhtmlcommon::row_closure()
1.133 raeburn 465: );
1.119 bisitz 466:
1.133 raeburn 467: $r->print(&Apache::lonhtmlcommon::row_headline()
1.109 bisitz 468: .'<h3>'.$lt{'assp'}.'</h3>'
469: .&Apache::lonhtmlcommon::row_closure()
470:
471: .&Apache::lonhtmlcommon::row_title($lt{'oaas'})
472: .'<input type="checkbox" name="openall" />'
473: .&Apache::lonhtmlcommon::row_closure()
474:
475: .&Apache::lonhtmlcommon::row_headline()
476: .'<h3>'.$lt{'mssg'}.'</h3>'
477: .&Apache::lonhtmlcommon::row_closure()
478:
479: .&Apache::lonhtmlcommon::row_title($lt{'scpf'})
480: .'<input type="checkbox" name="setpolicy" checked="checked" />'
481: .&Apache::lonhtmlcommon::row_closure()
482:
483: .&Apache::lonhtmlcommon::row_title($lt{'scfc'})
484: .'<input type="checkbox" name="setcontent" checked="checked" />'
485: .&Apache::lonhtmlcommon::row_closure()
486:
487: .&Apache::lonhtmlcommon::row_headline()
488: .'<h3>'.$lt{'cmmn'}.'</h3>'
489: .&Apache::lonhtmlcommon::row_closure()
490:
491: .&Apache::lonhtmlcommon::row_title($lt{'dsrd'})
492: .'<input type="checkbox" name="disresdis" />'
493: .&Apache::lonhtmlcommon::row_closure()
494:
495: .&Apache::lonhtmlcommon::row_title($lt{'dsuc'})
1.120 bisitz 496: .'<input type="checkbox" name="disablechat" />'
1.109 bisitz 497: .&Apache::lonhtmlcommon::row_closure()
498:
499: .&Apache::lonhtmlcommon::row_headline()
500: .'<h3>'.$lt{'acco'}.'</h3>'
501: .&Apache::lonhtmlcommon::row_closure()
502:
503: .&Apache::lonhtmlcommon::row_title($lt{'snak'})
504: .'<input type="checkbox" name="setkeys" />'
505: .&Apache::lonhtmlcommon::row_closure()
506:
507: .&Apache::lonhtmlcommon::row_title($lt{'kaut'})
508: .'<input type="text" size="30" name="keyauth" />'
509: .&Apache::lonhtmlcommon::row_closure()
510:
511: .&Apache::lonhtmlcommon::row_headline()
512: .'<h3>'.$lt{'rshm'}.'</h3>'
513: .&Apache::lonhtmlcommon::row_closure()
514:
515: .&Apache::lonhtmlcommon::row_title($lt{'rshm'})
516: .'<input type="text" name="reshome" size="30" value="/res/'.$defdom.'/" />'
517: .&Apache::lonhtmlcommon::row_closure()
1.133 raeburn 518: );
1.161 raeburn 519: unless ($crstype eq 'Community') {
1.133 raeburn 520: $r->print(&Apache::lonhtmlcommon::row_headline()
1.109 bisitz 521: .'<h3>'.$lt{'aens'}.'</h3>'
522: .&Apache::lonhtmlcommon::row_closure()
523:
524: .&Apache::lonhtmlcommon::row_title($lt{'aadd'})
525: .'<label><input type="radio" name="autoadds" value="1" />'.$lt{'yes'}.'</label>'
526: .'<label><input type="radio" name="autoadds" value="0" checked="checked" />'.$lt{'no'}.'</label>'
527: .&Apache::lonhtmlcommon::row_closure()
528:
529: .&Apache::lonhtmlcommon::row_title($lt{'audr'})
530: .'<label><input type="radio" name="autodrops" value="1" />'.$lt{'yes'}.'</label>'
531: .'<label><input type="radio" name="autodrops" value="0" checked="checked" />'.$lt{'no'}.'</label>'
532: .&Apache::lonhtmlcommon::row_closure()
533:
534: .&Apache::lonhtmlcommon::row_title($lt{'dacu'})
535: .$enroll_table
536: .&Apache::lonhtmlcommon::row_closure()
537:
538: .&Apache::lonhtmlcommon::row_title($lt{'psam'})
539: .$lt{'pcda'}.'<br />'
540: .$krbform.'<br />'
541: .$intform.'<br />'
542: .$locform
543: .&Apache::lonhtmlcommon::row_closure()
544:
545: .&Apache::lonhtmlcommon::row_title($lt{'nech'})
546: .$lt{'nccl'}.'<br/>'
547: .'<label><input type="radio" name="notify_owner" value="1" />'.$lt{'yes'}.'</label>'
548: .'<label><input type="radio" name="notify_owner" value="0" checked="checked" />'.$lt{'no'}.'</label>'
549: .'<br />'
550: .$lt{'ndcl'}.'<br/>'
551: .'<label><input type="radio" name="notify_dc" value="1" />'.$lt{'yes'}.'</label>'
552: .'<label><input type="radio" name="notify_dc" value="0" checked="checked" />'.$lt{'no'}.'</label>'
553: .&Apache::lonhtmlcommon::row_closure()
554:
555: .&Apache::lonhtmlcommon::row_title($lt{'irsp'})
556: .'<label>'
557: .'<input type="radio" name="showphotos" value="1" />'.$lt{'yes'}
558: .'</label> '
559: .'<label>'
560: .'<input type="radio" name="showphotos" value="0" checked="checked" />'.$lt{'no'}
561: .'</label> '
562: .&Apache::lonhtmlcommon::row_closure()
1.133 raeburn 563: );
564: }
565:
566: $r->print(&Apache::lonhtmlcommon::row_headline()
1.109 bisitz 567: .'<h3>'.$lt{'cgrs'}.'</h3>'
568: .&Apache::lonhtmlcommon::row_closure()
569:
570: .&Apache::lonhtmlcommon::row_title($lt{'cgrq'})
571: .'<input type="text" name="crsquota" value="20" size="6" />Mb'
572: .&Apache::lonhtmlcommon::row_closure(1)
573:
574: .&Apache::lonhtmlcommon::end_pick_box()
1.133 raeburn 575: .'</div>'
576: );
577: if ($crstype eq 'Course') {
578: $r->print('
1.55 www 579: <p>
1.90 raeburn 580: <input type="hidden" name="prevphase" value="courseone" />
581: <input type="hidden" name="phase" value="coursetwo" />
1.148 bisitz 582: <input type="button" onclick="verify_message(this.form)" value="'.$lt{'opco'}.'" />'
1.133 raeburn 583: );
1.123 raeburn 584: } elsif ($crstype eq 'Community') {
1.133 raeburn 585: $r->print('
1.90 raeburn 586: <p>
587: <input type="hidden" name="prevphase" value="groupone" />
588: <input type="hidden" name="phase" value="grouptwo" />
1.133 raeburn 589: <input type="submit" value="'.$lt{'opcm'}.'" />
590: </p>'
591: );
1.159 raeburn 592: } elsif ($crstype eq 'Placement') {
593: $r->print('
594: <p>
595: <input type="hidden" name="prevphase" value="placementone" />
596: <input type="hidden" name="phase" value="placementtwo" />
1.162 ! raeburn 597: <input type="button" onclick="verify_message(this.form)" value="'.$lt{'oppt'}.'" />
1.159 raeburn 598: </p>'
599: );
1.90 raeburn 600: }
1.133 raeburn 601: $r->print('</form>'.
602: $end_page);
1.40 raeburn 603: }
604:
1.2 www 605: # ====================================================== Phase two: make course
606:
1.10 matthew 607: sub create_course {
1.2 www 608: my $r=shift;
1.99 albertel 609: my $ccuname =&LONCAPA::clean_username($env{'form.ccuname'});
610: my $ccdomain=&LONCAPA::clean_domain($env{'form.ccdomain'});
1.123 raeburn 611: my $crstype = 'Community';
1.90 raeburn 612: my ($enrollstart,$enrollend,$startaccess,$endaccess);
1.147 raeburn 613: my %domdefaults =
614: &Apache::lonnet::get_domain_defaults($env{'request.role.domain'});
1.74 raeburn 615:
1.90 raeburn 616: if ($env{'form.phase'} eq 'coursetwo') {
617: $crstype='Course';
618: $enrollstart=&Apache::lonhtmlcommon::get_date_from_form('startenroll');
619: $enrollend=&Apache::lonhtmlcommon::get_date_from_form('endenroll');
1.159 raeburn 620: } elsif ($env{'form.phase'} eq 'placementtwo') {
621: $crstype='Placement';
1.90 raeburn 622: }
623: $startaccess = &Apache::lonhtmlcommon::get_date_from_form('startaccess');
624: $endaccess = &Apache::lonhtmlcommon::get_date_from_form('endaccess');
1.74 raeburn 625:
626: my $autharg;
627: my $authtype;
628:
1.78 albertel 629: if ($env{'form.login'} eq 'krb') {
1.74 raeburn 630: $authtype = 'krb';
1.78 albertel 631: $authtype .=$env{'form.krbver'};
632: $autharg = $env{'form.krbarg'};
633: } elsif ($env{'form.login'} eq 'int') {
1.74 raeburn 634: $authtype ='internal';
1.78 albertel 635: if ((defined($env{'form.intarg'})) && ($env{'form.intarg'})) {
636: $autharg = $env{'form.intarg'};
1.74 raeburn 637: }
1.78 albertel 638: } elsif ($env{'form.login'} eq 'loc') {
1.74 raeburn 639: $authtype = 'localauth';
1.78 albertel 640: if ((defined($env{'form.locarg'})) && ($env{'form.locarg'})) {
641: $autharg = $env{'form.locarg'};
1.74 raeburn 642: }
643: }
1.90 raeburn 644: my $logmsg;
1.91 albertel 645: my $start_page=&Apache::loncommon::start_page('Create a New '.$crstype);
1.90 raeburn 646: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Outcome','Create_Course',undef,'Create_Courses');
1.74 raeburn 647:
1.90 raeburn 648: $r->print($start_page.$crumbs);
1.74 raeburn 649:
650: my $args = {
1.90 raeburn 651: crstype => $crstype,
1.74 raeburn 652: ccuname => $ccuname,
653: ccdomain => $ccdomain,
1.78 albertel 654: cdescr => $env{'form.title'},
655: curl => $env{'form.topmap'},
656: course_domain => $env{'request.role.domain'},
657: course_home => $env{'form.course_home'},
658: nonstandard => $env{'form.nonstandard'},
659: crscode => $env{'form.crscode'},
1.93 raeburn 660: crsquota => $env{'form.crsquota'},
1.103 raeburn 661: clonecourse => $env{'form.clonecourse'},
662: clonedomain => $env{'form.clonedomain'},
1.106 www 663: datemode => $env{'form.datemode'},
664: dateshift => $env{'form.dateshift'},
1.78 albertel 665: crsid => $env{'form.crsid'},
1.94 raeburn 666: curruser => $env{'user.name'}.':'.$env{'user.domain'},
1.78 albertel 667: crssections => $env{'form.crssections'},
668: crsxlist => $env{'form.crsxlist'},
669: autoadds => $env{'form.autoadds'},
670: autodrops => $env{'form.autodrops'},
671: notify_owner => $env{'form.notify_owner'},
672: notify_dc => $env{'form.notify_dc'},
673: no_end_date => $env{'form.no_end_date'},
674: showphotos => $env{'form.showphotos'},
1.74 raeburn 675: authtype => $authtype,
676: autharg => $autharg,
677: enrollstart => $enrollstart,
678: enrollend => $enrollend,
679: startaccess => $startaccess,
680: endaccess => $endaccess,
1.78 albertel 681: setpolicy => $env{'form.setpolicy'},
682: setcontent => $env{'form.setcontent'},
683: reshome => $env{'form.reshome'},
684: setkeys => $env{'form.setkeys'},
685: keyauth => $env{'form.keyauth'},
686: disresdis => $env{'form.disresdis'},
687: disablechat => $env{'form.disablechat'},
688: openall => $env{'form.openall'},
689: firstres => $env{'form.firstres'}
1.74 raeburn 690: };
691:
1.147 raeburn 692: if (($crstype eq 'Course') &&
1.152 raeburn 693: ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'})) {
1.147 raeburn 694: $args->{'defaultcredits'} = $env{'form.defaultcredits'};
695: }
696:
1.153 raeburn 697: if ($env{'form.uniquecode'}) {
698: $args->{'uniquecode'} = 1;
699: }
700:
1.10 matthew 701: #
702: # Verify data
703: #
704: # Check the veracity of the course coordinator
1.2 www 705: if (&Apache::lonnet::homeserver($ccuname,$ccdomain) eq 'no_host') {
1.52 albertel 706: $r->print('<form action="/adm/createuser" method="post" name="crtuser">');
1.108 bisitz 707: $r->print('<div class="LC_warning">'
708: .&mt('No such user [_1] at domain [_2].','<tt>'.$ccuname.'</tt>','<tt>'.$ccdomain.'</tt>')
709: .'</div>');
710: $r->print(&mt('Please click Back on your browser and select another user, or [_1]Create User[_2]'
711: , '<input type="hidden" name="phase" value="get_user_info" />'
712: .'<input type="hidden" name="ccuname" value="'.$ccuname.'" />'
713: .'<input type="hidden" name="ccdomain" value="'.$ccdomain.'" />'
714: .'<input name="userrole" type="submit" value="'
715: , '" />'
716: )
717: .'</form>'.&Apache::loncommon::end_page()
718: );
1.2 www 719: return;
720: }
1.10 matthew 721: # Check the proposed home server for the course
1.101 albertel 722: my %host_servers =
723: &Apache::lonnet::get_servers($env{'request.role.domain'},'library');
1.78 albertel 724: if (! exists($host_servers{$env{'form.course_home'}})) {
1.108 bisitz 725: $r->print(&mt('Invalid home server for course: [_1]'
726: ,$env{'form.course_home'}.&Apache::loncommon::end_page()));
1.10 matthew 727: return;
728: }
1.153 raeburn 729: my ($courseid,$crsudom,$crsunum,$code);
1.104 albertel 730: my ($success,$output) =
731: &Apache::loncommon::construct_course($args,\$logmsg,\$courseid,
732: \$crsudom,\$crsunum,
733: $env{'user.domain'},
1.153 raeburn 734: $env{'user.name'},'dc_create',undef,undef,\$code);
1.104 albertel 735: $r->print($output);
736: if ($success) {
737: #
738: # Make the requested user a course coordinator or group coordinator
739: #
740: if (($ccdomain) && ($ccuname)) {
1.130 raeburn 741: my $ccrole = 'cc';
742: if ($crstype eq 'Community') {
743: $ccrole = 'co';
744: }
1.114 bisitz 745: $r->print(&mt('Assigning role of '.$crstype.' Coordinator to [_1]:',
746: ,'<i>'.$ccuname.':'.$ccdomain.'</i>')
747: .&Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid,
1.130 raeburn 748: $ccrole,'','','','','createcourse').'<p>');
1.104 albertel 749: }
750: if ($env{'form.setkeys'}) {
751: $r->print(
752: '<p><a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a></p>');
753: }
1.153 raeburn 754: if ($code) {
755: $r->print(
1.154 bisitz 756: '<p>'.&mt('Course identifier to share with students: [_1]',$code).'</p>'
1.153 raeburn 757: );
758: }
1.104 albertel 759: # Flush the course logs so reverse user roles immediately updated
1.144 raeburn 760: $r->register_cleanup(\&Apache::lonnet::flushcourselogs);
1.104 albertel 761: $r->print('<p>'.&mt('Roles will be active at next login').'.</p>');
762: }
763: $r->print('<p><a href="/adm/createcourse?phase='.lc($crstype).'one">'.
1.114 bisitz 764: &mt("Create Another $crstype").'</a></p>'.
1.86 albertel 765: &Apache::loncommon::end_page());
1.74 raeburn 766: }
767:
1.90 raeburn 768: sub print_intro_page {
1.159 raeburn 769: my ($r,$show_all_choices,$cancreate) = @_;
1.90 raeburn 770: my $start_page =
1.159 raeburn 771: &Apache::loncommon::start_page('Create a New Course, Community or Placement Test');
1.90 raeburn 772: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Options','Create_Course',undef,'Create_Courses');
773: my $end_page =
774: &Apache::loncommon::end_page();
1.123 raeburn 775: my $helplink=&Apache::loncommon::help_open_topic('Create_Course_Community',&mt('Help on Creating Courses and Communities'));
1.138 bisitz 776:
777: # Create menu
778: my @menu;
779: @menu =
780: ({ categorytitle => 'Course/Community Creation',
781: items => [
782: {
783: linktext => 'Create a single course',
784: url => '/adm/createcourse?phase=courseone',
785: permission => 1,
786: #help => '',
1.140 bisitz 787: icon => 'crsnew.png',
1.138 bisitz 788: linktitle => 'Create a new course by completing an online form.'
789: },
790: {
791: linktext => 'Create a single community',
792: url => '/adm/createcourse?phase=groupone',
1.159 raeburn 793: permission => $cancreate->{'Community'},
1.138 bisitz 794: #help => '',
1.140 bisitz 795: icon => 'crsnew.png',
1.138 bisitz 796: linktitle => 'Create a new collaborative community by completing an online form.'
797: },
798: {
1.159 raeburn 799: linktext => 'Create a single placement test',
800: url => '/adm/createcourse?phase=placementone',
801: permission => $cancreate->{'Placement'},
802: #help => '',
803: icon => 'crsnew.png',
804: linktitle => 'Create a new placement test by completing an online form.'
805: },
806: {
807: linktext => 'Create courses/communities/placement tests by uploading an attributes file',
1.138 bisitz 808: url => '/adm/createcourse?phase=batchone',
809: permission => 1,
810: help => 'Batch_Creation',
1.140 bisitz 811: icon => 'uplcrs.png',
1.159 raeburn 812: linktitle => 'Upload an attributes file containing specifications for one or more courses, communities or placement tests in XML format.'
1.138 bisitz 813: },
814: ]
815: },
816: { categorytitle => 'Course/Community Requests',
817: items => [
818: {
819: linktext => 'Approve or reject requests',
820: url => '/adm/createcourse?phase=requestdisplay',
821: permission => $show_all_choices,
822: #help => '',
1.140 bisitz 823: icon => 'rcrs.png',
1.159 raeburn 824: linktitle => 'Display course, community creation and placement test requests submitted by authorized users, held pending approval by a Domain Coordinator.'
1.138 bisitz 825: },
826: {
1.142 raeburn 827: linktext => 'View pending official course requests',
1.138 bisitz 828: url => '/adm/createcourse?phase=pendingdisplay',
829: permission => $show_all_choices,
830: #help => '',
1.142 raeburn 831: icon => 'edit-find.png',
1.140 bisitz 832: alttext => '',
1.138 bisitz 833: linktitle => 'Display official course requests submitted by authorized users, held pending validation of instructor status.'
834: },
835: ]
836: },
837: { categorytitle => 'Administration',
838: items => [
839: {
840: linktext => 'View creation log',
841: url => '/adm/createcourse?phase=creationlog',
842: permission => $show_all_choices,
843: #help => '',
844: icon => 'document-properties.png',
1.159 raeburn 845: linktitle => 'Display information about when, how and by whom courses, communities and placement tests were created in this domain.'
1.138 bisitz 846: },
847: ]
848: },
849: );
850:
851: $r->print(
852: $start_page
853: .$crumbs
854: .&Apache::lonhtmlcommon::generate_menu(@menu)
855: .$end_page
856: );
1.90 raeburn 857: }
858:
859: sub upload_batchfile {
860: my $r = shift;
861: my $start_page =
1.159 raeburn 862: &Apache::loncommon::start_page('Create a New Course, Community, or Placement Test');
863: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Upload Course/Community/Placement Test Attributes File','Create_Course',undef,'Create_Courses');
1.90 raeburn 864: my $end_page =
865: &Apache::loncommon::end_page();
866: $r->print($start_page.$crumbs);
1.159 raeburn 867: $r->print('<h3>'.&mt('Upload a courses, communities or placement tests attributes file').'</h3>');
1.90 raeburn 868: $r->print('<form name="batchcreate" method="post" '.
869: 'enctype="multipart/form-data" action="/adm/createcourse">'.
870: '<input type="file" name="coursecreatorxml" />'.
1.121 bisitz 871: '<input type="hidden" name="phase" value="batchtwo" /><br /><br />'.
1.90 raeburn 872: '<input type="submit" name="batchsubmit" '.
1.159 raeburn 873: 'value="'.&mt('Create Courses/Communities/Placement Tests').'" /></form>');
1.90 raeburn 874: $r->print($end_page);
875: return;
876: }
877:
878: sub process_batchfile {
879: my $r = shift;
880: my $start_page =
1.159 raeburn 881: &Apache::loncommon::start_page('Create a New Course, Community or Placement Test');
1.90 raeburn 882: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Outcome','Create_Course',undef,'Create_Courses');
883: my $end_page =
884: &Apache::loncommon::end_page();
885: my $defdom=$env{'request.role.domain'};
886: my $batchfilepath=&Apache::lonnet::userfileupload('coursecreatorxml',undef,
887: 'batchupload',undef,undef,
888: undef,undef,$defdom);
889: my ($batchdir,$filename) = ($batchfilepath =~ m-^(.+)/pending/([^/]+)$-);
890: my ($result,$logmsg);
891: if (-e "$batchfilepath") {
892: open(FILE,"<$batchfilepath");
893: my @buffer = <FILE>;
894: close(FILE);
895: if ((defined($filename)) && (defined($batchdir))) {
896: my @requests = ($filename);
897: my %courseids = ();
898: ($result,$logmsg) = &LONCAPA::batchcreatecourse::create_courses(
899: \@requests,\%courseids,'web',$defdom,
900: $env{'user.name'},$env{'user.domain'});
901: if ($result) {
902: if (!-e "$batchdir/processed") {
903: mkdir("$batchdir/processed", 0755);
904: open(FILE,">$batchdir/processed/$filename");
905: print FILE @buffer;
906: close(FILE);
907: if (-e "$batchdir/processed/$filename") {
908: unlink("$batchdir/pending/$filename");
909: }
910: }
911: }
912: }
913: }
1.103 raeburn 914: $r->print($start_page.$crumbs.$logmsg.$result.'<br /><a href="/adm/createcourse">'.
915: &mt('Creation options menu').'</a>'.$end_page);
1.90 raeburn 916:
917: }
918:
1.126 raeburn 919: sub courserequestbrowser_javascript {
920: return <<"ENDREQBRW";
921: <script type="text/javascript">
922: // <![CDATA[
923: var steditbrowser;
1.136 raeburn 924: function opencoursereqdisplay(cdom,cnum,queue) {
1.126 raeburn 925: var url = '/adm/requestcourse?action=display';
1.136 raeburn 926: url += '&showdom='+cdom+'&cnum='+cnum+'&queue='+queue;
1.126 raeburn 927: var title = 'Course_Request_Browser';
928: var options = 'scrollbars=1,resizable=1,menubar=0';
929: options += ',width=700,height=600';
930: var stdeditbrowser = open(url,title,options,'1');
931: stdeditbrowser.focus();
932: }
1.136 raeburn 933:
1.126 raeburn 934: // ]]>
935: </script>
936: ENDREQBRW
937: }
938:
1.127 raeburn 939: sub print_creation_logs {
940: my ($r) = @_;
941: my $formname = 'creationlog';
942: my $dom = $env{'request.role.domain'};
943: $r->print('<form action="/adm/createcourse" method="post" name="'.$formname.'">');
944: # set defaults
945: my $now = time();
946: my $defstart = $now - (7*24*3600); #7 days ago
947: my %defaults = (
948: page => '1',
949: show => '10',
950: type => 'any',
951: context => 'any',
952: created_before_date => $now,
953: created_after_date => $defstart,
954: );
955: my ($contexts,$contextnames) = &context_names();
956: my $more_records = 0;
957: my %curr;
958: foreach my $item ('show','page','type','context') {
959: $curr{$item} = $env{'form.'.$item};
960: }
961: $curr{'created_after_date'} = &Apache::lonhtmlcommon::get_date_from_form('created_after_date');
962: $curr{'created_before_date'} = &Apache::lonhtmlcommon::get_date_from_form('created_before_date');
963: foreach my $key (keys(%defaults)) {
964: if ($curr{$key} eq '') {
965: $curr{$key} = $defaults{$key};
966: }
967: }
1.135 raeburn 968: my %whodunit;
969: $r->print(&creation_display_filter($formname,\%curr));
1.127 raeburn 970: my $showntablehdr = 0;
971: my $tablehdr = &Apache::loncommon::start_data_table().
972: &Apache::loncommon::start_data_table_header_row().
973: '<th> </th><th>'.&mt('Creation Date').'</th>'.
974: '<th>'.&mt('Creator').'</th><th>'.&mt('Description').'</th>'.
1.131 raeburn 975: '<th>'.&mt('Owner(s)').'</th>';
1.127 raeburn 976: if (($curr{'type'} eq 'official') || ($curr{'type'} eq 'any')) {
977: $tablehdr .= '<th>'.&mt('Institutional Code').'</th>';
1.128 raeburn 978: }
979: if ($curr{'type'} eq 'any') {
980: $tablehdr .= '<th>'.&mt('Course Type').'</th>';
981: }
1.129 raeburn 982: if ($curr{'context'} eq 'any') {
1.128 raeburn 983: $tablehdr .= '<th>'.&mt('Creation Context').'</th>';
984: }
985: $tablehdr .= &Apache::loncommon::end_data_table_header_row();
1.127 raeburn 986: my ($minshown,$maxshown);
987: $minshown = 1;
988: my $count = 0;
989: if ($curr{'show'} ne &mt('all')) {
990: $maxshown = $curr{'page'} * $curr{'show'};
991: if ($curr{'page'} > 1) {
992: $minshown = 1 + ($curr{'page'} - 1) * $curr{'show'};
993: }
994: }
995: my $crstype = 'Course';
996: if ($curr{'type'} eq 'any') {
997: $crstype = '.';
998: } elsif ($curr{'type'} eq 'community') {
999: $crstype = 'Community';
1.159 raeburn 1000: } elsif ($curr{'type'} eq 'placement') {
1001: $crstype = 'Placement';
1.127 raeburn 1002: }
1003:
1004: my ($instcodefilter,$regexpok);
1005: my (@codetitles,%cat_titles,%cat_order,%cat_items,$officialjs);
1006: my ($jscript,$totcodes,$numtitles,$lasttitle) =
1007: &Apache::courseclassifier::instcode_selectors_data($dom,$formname,
1008: \%cat_items,\@codetitles,\%cat_titles,\%cat_order,
1009: $officialjs);
1010: if ($numtitles) {
1011: if (($curr{'type'} eq 'official') || ($curr{'type'} eq 'unofficial')) {
1012: $instcodefilter = &instcode_srchstr($dom,$numtitles);
1.141 raeburn 1013: &Apache::courseclassifier::instcode_search_str($dom,$numtitles,\@codetitles);
1.127 raeburn 1014: if ($curr{'type'} eq 'official') {
1015: $regexpok = 1;
1016: } else {
1017: unless ($instcodefilter eq '') {
1018: $regexpok = -1;
1019: }
1020: }
1021: }
1022: }
1023: if ($instcodefilter eq '') { $instcodefilter = '.'; }
1024:
1025: my $creationcontext = '.';
1026: my $context_regexp = join('|',@{$contexts});
1027: if ($curr{'context'} =~ /^($context_regexp)$/) {
1028: $creationcontext = $curr{'context'};
1029: }
1030: my %courses =
1031: &Apache::lonnet::courseiddump($dom,'.',1,$instcodefilter,'.','.',undef,undef,
1032: $crstype,$regexpok,undef,undef,'1','creationlog',
1033: undef,undef,undef,$curr{'created_before_date'},
1034: $curr{'created_after_date'},$creationcontext);
1035: foreach my $cid (sort { $courses{$b}{'created'}<=>$courses{$a}{'created'} } (keys(%courses))) {
1.136 raeburn 1036: if ($curr{'show'} ne &mt('all')) {
1037: if ($count >= $curr{'page'} * $curr{'show'}) {
1038: $more_records = 1;
1039: last;
1040: }
1041: }
1.127 raeburn 1042: $count ++;
1043: next if ($count < $minshown);
1044: if (!$showntablehdr) {
1045: $r->print($tablehdr);
1046: $showntablehdr = 1;
1047: }
1048: if ($courses{$cid}{'creator'} ne '') {
1049: if ($whodunit{$courses{$cid}{'creator'}} eq '') {
1050: my ($uname,$udom) = split(':',$courses{$cid}{'creator'});
1051: $whodunit{$courses{$cid}{'creator'}} =
1052: &Apache::loncommon::plainname($uname,$udom);
1053: }
1054: }
1055: my $description = $courses{$cid}{'description'};
1056: my @owners;
1057: my $singleowner = $courses{$cid}{'owner'};
1058: push(@owners,$singleowner);
1059: if (ref($courses{$cid}{'co-owners'}) eq 'ARRAY') {
1060: foreach my $item (@{$courses{$cid}{'co-owners'}}) {
1061: push(@owners,$item);
1062: }
1063: }
1064: my %ownernames;
1065: foreach my $owner (@owners) {
1066: my ($ownername,$ownerdom);
1067: if ($owner =~ /:/) {
1068: ($ownername,$ownerdom) = split(/:/,$owner);
1069: } else {
1070: $ownername = $owner;
1071: if ($owner ne '') {
1072: $ownerdom = $dom;
1073: }
1074: }
1075: if ($ownername ne '' && $ownerdom ne '') {
1076: unless (ref($ownernames{$ownername.':'.$ownerdom}) eq 'HASH') {
1077: my %namehash=&Apache::loncommon::getnames($ownername,$ownerdom);
1078: $ownernames{$ownername.':'.$ownerdom} = \%namehash;
1079: }
1080: }
1081: }
1082: my @lastnames;
1083: foreach my $owner (keys(%ownernames)) {
1084: if (ref($ownernames{$owner}) eq 'HASH') {
1085: push(@lastnames,$ownernames{$owner}{'lastname'});
1086: }
1087: }
1088: my $ownerlastnames = join(', ',sort(@lastnames));
1089: my $showtype;
1090: if ($courses{$cid}{type} eq 'Community') {
1091: $showtype = &mt('community');
1.159 raeburn 1092: } elsif ($courses{$cid}{type} eq 'Placement') {
1093: $showtype = &mt('placement test');
1.127 raeburn 1094: } else {
1095: my $instcode = $courses{$cid}{inst_code};
1096: if ($instcode ne '') {
1097: $showtype = &mt('official');
1098: } else {
1099: $showtype = &mt('unofficial');
1100: }
1101: }
1102: my $showcontext;
1103:
1104: if ($courses{$cid}{context} =~ /^($context_regexp)$/) {
1105: $showcontext = $contextnames->{$courses{$cid}{context}};
1106: }
1107: my $created = &Apache::lonlocal::locallocaltime($courses{$cid}{'created'});
1108: my ($cdom,$cnum) = split('_',$cid);
1109: $r->print(&Apache::loncommon::start_data_table_row()."\n".
1110: '<td>'.$count.'</td><td>'.$created.'</td>'."\n".
1111: '<td>'.$whodunit{$courses{$cid}{creator}}.'</td>'."\n".
1112: '<td>'.$description.' <a href="javascript:ToSyllabus('."'$cdom','$cnum'".')">'.&mt('Syllabus').'</a></td><td>'.$ownerlastnames.'</td>');
1113: if (($curr{'type'} eq 'official') || ($curr{'type'} eq 'any')) {
1114: $r->print('<td>'.$courses{$cid}{'inst_code'}.'</td>');
1115: }
1.128 raeburn 1116: if ($curr{'type'} eq 'any') {
1117: $r->print('<td>'.$showtype.'</td>');
1118: }
1119: if ($curr{'context'} eq 'any') {
1120: $r->print('<td>'.$showcontext.'</td>');
1121: }
1122: $r->print('<td>'.&Apache::loncommon::end_data_table_row()."\n");
1.127 raeburn 1123: }
1124: if ($showntablehdr) {
1125: $r->print(&Apache::loncommon::end_data_table().'<br />');
1126: if (($curr{'page'} > 1) || ($more_records)) {
1127: $r->print('<table><tr>');
1128: if ($curr{'page'} > 1) {
1129: $r->print('<td><a href="javascript:chgPage('."'previous'".');">'.&mt('Previous [_1] changes',$curr{'show'}).'</a></td>');
1130: }
1131: if ($more_records) {
1132: $r->print('<td><a href="javascript:chgPage('."'next'".');">'.&mt('Next [_1] changes',$curr{'show'}).'</a></td>');
1133: }
1134: $r->print('</tr></table>');
1135: $r->print(<<"ENDSCRIPT");
1136: <script type="text/javascript">
1137: // <![CDATA[
1138: function chgPage(caller) {
1139: if (caller == 'previous') {
1140: document.$formname.page.value --;
1141: }
1142: if (caller == 'next') {
1143: document.$formname.page.value ++;
1144: }
1145: document.$formname.submit();
1146: return;
1147: }
1148: // ]]>
1149: </script>
1150: ENDSCRIPT
1151: }
1152: } else {
1153: $r->print('<p class="LC_info">'.
1154: &mt('There are no records to display').
1155: '</p>');
1156: }
1157: $r->print('<input type="hidden" name="page" value="'.$curr{'page'}.'" />'.
1158: '<input type="hidden" name="phase" value="creationlog" /></form>');
1159: return;
1160: }
1161:
1162: sub creation_display_filter {
1.135 raeburn 1163: my ($formname,$curr) = @_;
1.127 raeburn 1164: my $nolink = 1;
1165: my ($contexts,$contextnames) = &context_names();
1166: my $output = '<table><tr><td valign="top">'.
1167: '<span class="LC_nobreak"><b>'.&mt('Records/page:').'</b></span><br />'.
1168: &Apache::lonmeta::selectbox('show',$curr->{'show'},undef,
1169: (&mt('all'),5,10,20,50,100,1000,10000)).
1170: '</td><td> </td>';
1171: my $startform =
1172: &Apache::lonhtmlcommon::date_setter($formname,'created_after_date',
1173: $curr->{'created_after_date'},undef,
1174: undef,undef,undef,undef,undef,undef,$nolink);
1175: my $endform =
1176: &Apache::lonhtmlcommon::date_setter($formname,'created_before_date',
1177: $curr->{'created_before_date'},undef,
1178: undef,undef,undef,undef,undef,undef,$nolink);
1.136 raeburn 1179: $output .= '<td valign="top"><b>'.&mt('Window during which course/community was created:').'</b><br />'.
1.127 raeburn 1180: '<table><tr><td>'.&mt('After:').
1181: '</td><td>'.$startform.'</td></tr>'.
1182: '<tr><td>'.&mt('Before:').'</td>'.
1183: '<td>'.$endform.'</td></tr></table>'.
1184: '</td>'.
1185: '<td> </td>';
1.136 raeburn 1186: my ($types,$typenames) = &Apache::loncommon::course_types();
1.127 raeburn 1187: if (ref($types) eq 'ARRAY') {
1188: if (@{$types} > 1) {
1189: $output .= '<td valign="top"><b>'.
1190: &mt('Course Type:').'</b><br /><select name="type">';
1191: my $selstr = '';
1192: if ($curr->{'type'} eq 'any') {
1193: $selstr = ' selected="selected"';
1194: }
1195: $output .= '<option value="any"'.$selstr.'>'.&mt('Any').'</option>'."\n";
1196: foreach my $type (@{$types}) {
1197: my $selstr = '';
1198: if ($curr->{'type'} eq $type) {
1199: $selstr = ' selected="selected"';
1200: }
1201: my $typename = $type;
1202: if (ref($typenames) eq 'HASH') {
1203: if ($typenames->{$type} ne '') {
1204: $typename = $typenames->{$type};
1205: }
1206: }
1.155 bisitz 1207: $output .= '<option value="'.$type.'"'.$selstr.'>'.&mt($typename).'</option>'."\n";
1.127 raeburn 1208: }
1209: $output .= '</select></td>';
1210: }
1211: }
1212: $output .= '<td> </td>'.
1213: '<td valign="top"><b>'.
1214: &mt('Creation Context:').'</b><br /><select name="context">';
1215: foreach my $context ('any',@{$contexts}) {
1216: my $selstr = '';
1217: if ($curr->{'context'} eq $context) {
1218: $selstr = ' selected="selected"';
1219: }
1220: $output .= '<option value="'.$context.'"'.$selstr.'>';
1221: if ($context eq 'any') {
1222: $output .= &mt('Any');
1223: } else {
1224: $output .= $contextnames->{$context};
1225: }
1226: $output .= '</option>'."\n";
1227: }
1228: $output .= '</select></td>'.
1229: '</tr></table>';
1230:
1231: # Update Display button
1232: $output .= '<p>'.
1233: '<input type="submit" value="'.&mt('Update Display').'" />'.
1.135 raeburn 1234: '</p><hr />';
1.127 raeburn 1235: return $output;
1236: }
1237:
1238: sub context_names {
1.128 raeburn 1239: my @contexts = qw(auto web dc_create requestcourses);
1.127 raeburn 1240: my %contextnames =
1241: &Apache::lonlocal::texthash (
1.128 raeburn 1242: auto => 'Automated creation from batch file',
1243: web => 'Batch creation from uploaded file',
1.131 raeburn 1244: dc_create => 'Course or community created by Dom. Coord.',
1.128 raeburn 1245: requestcourses => 'Processing of submitted course request',
1.127 raeburn 1246: );
1247: return (\@contexts,\%contextnames);
1248: }
1249:
1250: sub instcode_srchstr {
1251: my ($domain,$numtitles) = @_;
1252: my $instcode;
1253: if (defined($numtitles) && $numtitles == 0) {
1254: $instcode = '.+';
1255: } else {
1256: my (%codedefaults,@code_order);
1257: my $defaults_result =
1258: &Apache::lonnet::auto_instcode_defaults($domain,\%codedefaults,
1259: \@code_order);
1260: if ($defaults_result eq 'ok') {
1261: $instcode ='^';
1262: foreach my $item (@code_order) {
1263: $instcode .= $codedefaults{$item};
1264: }
1265: $instcode .= '$';
1266: } else {
1267: $instcode = '.+';
1268: }
1269: }
1270: return $instcode;
1271: }
1272:
1273: sub syllabuslink_javascript {
1274: return <<"ENDJS";
1275:
1276: function ToSyllabus(cdom,cnum) {
1277: if (cdom == '' || cdom == null) {
1278: return;
1279: }
1280: if (cnum == '' || cnum == null) {
1281: return;
1282: }
1283: var options = 'height=600,width=800,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no';
1284: var url = "/public/"+cdom+"/"+cnum+"/syllabus";
1285: syllwin = window.open(url,'',options,1);
1286: syllwin.focus();
1287: return;
1288: }
1289:
1290: ENDJS
1291:
1292: }
1.126 raeburn 1293:
1.2 www 1294: # ===================================================================== Handler
1.1 www 1295: sub handler {
1296: my $r = shift;
1297:
1298: if ($r->header_only) {
1.38 www 1299: &Apache::loncommon::content_type($r,'text/html');
1.1 www 1300: $r->send_http_header;
1301: return OK;
1302: }
1303:
1.137 raeburn 1304: my $show_all_choices = 0;
1305: my $primary_rev = &Apache::lonnet::get_server_loncaparev($env{'request.role.domain'});
1.159 raeburn 1306: my %cancreate = (
1307: Community => 0,
1308: Placement => 0,
1309: );
1310:
1.137 raeburn 1311: if (($primary_rev ne 'refused') && ($primary_rev ne 'error') &&
1312: ($primary_rev ne 'unknown_cmd') && ($primary_rev ne 'no_such_host')) {
1313: $show_all_choices = 1;
1.159 raeburn 1314: my ($primary_major,$primary_minor) = split(/\./,$primary_rev);
1315: foreach my $key (keys(%cancreate)) {
1316: my ($needsmajor,$needsminor) =
1317: split(/\./,$Apache::lonnet::needsrelease{'course:crstype:'.$key});
1318: unless (($needsmajor > $primary_major) ||
1319: (($needsmajor == $primary_major) && ($needsminor > $primary_minor))) {
1320: $cancreate{$key} = 1;
1321: }
1322: }
1.137 raeburn 1323: }
1324:
1.78 albertel 1325: if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
1.38 www 1326: &Apache::loncommon::content_type($r,'text/html');
1.1 www 1327: $r->send_http_header;
1328:
1.90 raeburn 1329: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
1330: ['phase']);
1331: &Apache::lonhtmlcommon::clear_breadcrumbs();
1332: &Apache::lonhtmlcommon::add_breadcrumb
1333: ({href=>"/adm/createcourse",
1334: text=>"Creation Options",
1335: faq=>79,bug=>'Dom Coord Interface',});
1336: if (($env{'form.phase'} eq 'coursetwo') ||
1.137 raeburn 1337: (($env{'form.phase'} eq 'grouptwo') &&
1.159 raeburn 1338: ($cancreate{'Community'})) ||
1339: (($env{'form.phase'} eq 'placementtwo') &&
1340: ($cancreate{'Placement'}))) {
1.90 raeburn 1341: &Apache::lonhtmlcommon::add_breadcrumb
1342: ({href=>"/adm/createcourse?phase=$env{'form.prevphase'}",
1343: text=>&mt('[_1] Creation Settings',),
1344: faq=>9,bug=>'Dom Coord Interface',});
1345: &Apache::lonhtmlcommon::add_breadcrumb
1346: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1347: text=>"Creation Outcome",
1348: faq=>9,bug=>'Dom Coord Interface',});
1.10 matthew 1349: &create_course($r);
1.90 raeburn 1350: } elsif (($env{'form.phase'} eq 'courseone') ||
1.137 raeburn 1351: (($env{'form.phase'} eq 'groupone') &&
1.159 raeburn 1352: ($cancreate{'Community'})) ||
1353: (($env{'form.phase'} eq 'placementone') &&
1354: ($cancreate{'Placement'}))) {
1.90 raeburn 1355: &Apache::lonhtmlcommon::add_breadcrumb
1356: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1357: text=>&mt('[_1] Creation Settings',),
1358: faq=>9,bug=>'Dom Coord Interface',});
1359: &print_course_creation_page($r);
1360: } elsif ($env{'form.phase'} eq 'batchone') {
1361: &Apache::lonhtmlcommon::add_breadcrumb
1362: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1363: text=>"Upload Description File",
1364: faq=>9,bug=>'Dom Coord Interface',});
1365: &upload_batchfile($r);
1366: } elsif ($env{'form.phase'} eq 'batchtwo') {
1367: &Apache::lonhtmlcommon::add_breadcrumb
1368: ({href=>"/adm/createcourse?phase=$env{'form.prevphase'}",
1369: text=>"Upload Description File",
1370: faq=>9,bug=>'Dom Coord Interface',});
1371: &Apache::lonhtmlcommon::add_breadcrumb
1372: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1373: text=>"Creation Outcome",
1374: faq=>9,bug=>'Dom Coord Interface',});
1375: &process_batchfile($r);
1.137 raeburn 1376: } elsif (($env{'form.phase'} eq 'requestdisplay') && ($show_all_choices)) {
1.125 raeburn 1377: &Apache::lonhtmlcommon::add_breadcrumb
1378: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1379: text=>&mt('[_1] Display Request Queue',),
1380: faq=>9,bug=>'Dom Coord Interface',});
1.126 raeburn 1381: my $js = &courserequestbrowser_javascript();
1382: my $start_page=&Apache::loncommon::start_page('Display Requests',$js);
1.156 bisitz 1383: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Display Requests','Course_Requests',undef,'Course_Requests');
1.125 raeburn 1384: $r->print($start_page.$crumbs."\n".'<div>'.
1385: &Apache::loncoursequeueadmin::display_queued_requests(
1386: 'domain',$env{'request.role.domain'}).'</div>'.
1387: &Apache::loncommon::end_page());
1.137 raeburn 1388: } elsif (($env{'form.phase'} eq 'requestchange') && ($show_all_choices)) {
1.136 raeburn 1389: if ($env{'form.queue'} eq 'pending') {
1390: &Apache::lonhtmlcommon::add_breadcrumb
1391: ({href=>"/adm/createcourse?phase=pendingdisplay",
1392: text=>&mt('Display Pending Queue',),
1393: faq=>9,bug=>'Dom Coord Interface',});
1394: } else {
1395: &Apache::lonhtmlcommon::add_breadcrumb
1396: ({href=>"/adm/createcourse?phase=requestdisplay",
1397: text=>&mt('[_1] Display Request Queue',),
1398: faq=>9,bug=>'Dom Coord Interface',});
1399: }
1.125 raeburn 1400: &Apache::lonhtmlcommon::add_breadcrumb
1.136 raeburn 1401: ({href=>"/adm/createcourse?phase=requestchange",
1402: text=>&mt('[_1] Requests Updated',),
1403: faq=>9,bug=>'Dom Coord Interface',},);
1.125 raeburn 1404: my $start_page=&Apache::loncommon::start_page('Update Requests Result');
1.156 bisitz 1405: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Requests Updated','Course_Requests',undef,'Course_Requests');
1.125 raeburn 1406: $r->print($start_page.$crumbs."\n".'<div>'.
1407: &Apache::loncoursequeueadmin::update_request_queue(
1408: 'domain',$env{'request.role.domain'}).'</div>'.
1409: &Apache::loncommon::end_page());
1.137 raeburn 1410: } elsif (($env{'form.phase'} eq 'pendingdisplay') && ($show_all_choices)) {
1.136 raeburn 1411: &Apache::lonhtmlcommon::add_breadcrumb
1412: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1413: text=>&mt('Display Pending Queue',),
1414: faq=>9,bug=>'Dom Coord Interface',});
1415: my $js = &courserequestbrowser_javascript();
1416: my $start_page=&Apache::loncommon::start_page('Display Pending Queue',$js);
1.156 bisitz 1417: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Display Pending Queue','Course_Requests',undef,'Course_Requests');
1.136 raeburn 1418: $r->print($start_page.$crumbs."\n".'<div>'.
1419: &Apache::loncoursequeueadmin::display_queued_requests(
1420: 'pending',$env{'request.role.domain'}).'</div>'.
1421: &Apache::loncommon::end_page());
1.137 raeburn 1422: } elsif (($env{'form.phase'} eq 'requestvalidation') && ($show_all_choices)) {
1.136 raeburn 1423: my $js = &courserequestbrowser_javascript();
1424: &Apache::lonhtmlcommon::add_breadcrumb
1425: ({href=>"/adm/createcourse?phase=pendingdisplay",
1426: text=>&mt('Display Pending Queue'),},
1427: {href=>"/adm/createcourse?phase=requestvalidation",
1428: text=>&mt('Validation Attempted'),},);
1429: my $start_page=&Apache::loncommon::start_page('Requests Validation Result',$js);
1.156 bisitz 1430: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Validation Attempted','Course_Requests',undef,'Course_Requests');
1.136 raeburn 1431: $r->print($start_page.$crumbs."\n".'<div>'.
1432: &Apache::loncoursequeueadmin::process_official_reqs('domain',$env{'request.role.domain'}).'</div>'.
1433: &Apache::loncommon::end_page());
1.137 raeburn 1434: } elsif (($env{'form.phase'} eq 'creationlog') && ($show_all_choices)) {
1.127 raeburn 1435: &Apache::lonhtmlcommon::add_breadcrumb
1436: ({href=>"/adm/createcourse?phase=creationlog",
1437: text=>&mt('[_1] Display Creation History',),});
1438: my $js = '<script type="text/javascript">'."\n".
1439: '// <![CDATA['."\n".
1440: &syllabuslink_javascript()."\n".
1441: '// ]]>'."\n".
1442: '</script>';
1.131 raeburn 1443: my $start_page=&Apache::loncommon::start_page('Course/Community Creation Logs',$js);
1.151 raeburn 1444: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Created Courses/Communities','Course_Creation_Log',undef,'Course_Creation_Log');
1.127 raeburn 1445: $r->print($start_page.$crumbs."\n".'<div>');
1446: &print_creation_logs($r);
1447: $r->print('</div>'.&Apache::loncommon::end_page());
1.2 www 1448: } else {
1.159 raeburn 1449: &print_intro_page($r,$show_all_choices,\%cancreate);
1.2 www 1450: }
1.1 www 1451: } else {
1.78 albertel 1452: $env{'user.error.msg'}=
1.127 raeburn 1453: "/adm/createcourse:ccc:0:0:Cannot create courses or communities";
1.1 www 1454: return HTTP_NOT_ACCEPTABLE;
1455: }
1456: return OK;
1.90 raeburn 1457: }
1.1 www 1458:
1459: 1;
1460: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>