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