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