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