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