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