Annotation of loncom/interface/loncreatecourse.pm, revision 1.164
1.65 raeburn 1: # The LearningOnline Network
1.1 www 2: # Create a course
1.5 albertel 3: #
1.164 ! raeburn 4: # $Id: loncreatecourse.pm,v 1.163 2016/08/25 22:33:03 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.164 ! raeburn 776: my ($r,$show_all_choices,$cancreate,$permission) = @_;
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
1.164 ! raeburn 785: my $approve = 'Display requests awaiting approval';
! 786: if ($permission->{'create'}) {
! 787: $approve = 'Approve or reject requests';
! 788: }
1.138 bisitz 789: my @menu;
790: @menu =
791: ({ categorytitle => 'Course/Community Creation',
792: items => [
793: {
794: linktext => 'Create a single course',
795: url => '/adm/createcourse?phase=courseone',
1.164 ! raeburn 796: permission => $permission->{'create'},
1.138 bisitz 797: #help => '',
1.140 bisitz 798: icon => 'crsnew.png',
1.138 bisitz 799: linktitle => 'Create a new course by completing an online form.'
800: },
801: {
802: linktext => 'Create a single community',
803: url => '/adm/createcourse?phase=groupone',
1.164 ! raeburn 804: permission => $permission->{'create'} && $cancreate->{'Community'},
1.138 bisitz 805: #help => '',
1.140 bisitz 806: icon => 'crsnew.png',
1.138 bisitz 807: linktitle => 'Create a new collaborative community by completing an online form.'
808: },
809: {
1.159 raeburn 810: linktext => 'Create a single placement test',
811: url => '/adm/createcourse?phase=placementone',
1.164 ! raeburn 812: permission => $permission->{'create'} && $cancreate->{'Placement'},
1.159 raeburn 813: #help => '',
814: icon => 'crsnew.png',
815: linktitle => 'Create a new placement test by completing an online form.'
816: },
817: {
818: linktext => 'Create courses/communities/placement tests by uploading an attributes file',
1.138 bisitz 819: url => '/adm/createcourse?phase=batchone',
1.164 ! raeburn 820: permission => $permission->{'create'},
1.138 bisitz 821: help => 'Batch_Creation',
1.140 bisitz 822: icon => 'uplcrs.png',
1.159 raeburn 823: linktitle => 'Upload an attributes file containing specifications for one or more courses, communities or placement tests in XML format.'
1.138 bisitz 824: },
825: ]
826: },
827: { categorytitle => 'Course/Community Requests',
828: items => [
829: {
1.164 ! raeburn 830: linktext => $approve,
1.138 bisitz 831: url => '/adm/createcourse?phase=requestdisplay',
832: permission => $show_all_choices,
833: #help => '',
1.140 bisitz 834: icon => 'rcrs.png',
1.159 raeburn 835: linktitle => 'Display course, community creation and placement test requests submitted by authorized users, held pending approval by a Domain Coordinator.'
1.138 bisitz 836: },
837: {
1.142 raeburn 838: linktext => 'View pending official course requests',
1.138 bisitz 839: url => '/adm/createcourse?phase=pendingdisplay',
840: permission => $show_all_choices,
841: #help => '',
1.142 raeburn 842: icon => 'edit-find.png',
1.140 bisitz 843: alttext => '',
1.138 bisitz 844: linktitle => 'Display official course requests submitted by authorized users, held pending validation of instructor status.'
845: },
846: ]
847: },
848: { categorytitle => 'Administration',
849: items => [
850: {
851: linktext => 'View creation log',
852: url => '/adm/createcourse?phase=creationlog',
853: permission => $show_all_choices,
854: #help => '',
855: icon => 'document-properties.png',
1.159 raeburn 856: linktitle => 'Display information about when, how and by whom courses, communities and placement tests were created in this domain.'
1.138 bisitz 857: },
858: ]
859: },
860: );
861:
862: $r->print(
863: $start_page
864: .$crumbs
865: .&Apache::lonhtmlcommon::generate_menu(@menu)
866: .$end_page
867: );
1.90 raeburn 868: }
869:
870: sub upload_batchfile {
871: my $r = shift;
872: my $start_page =
1.159 raeburn 873: &Apache::loncommon::start_page('Create a New Course, Community, or Placement Test');
874: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Upload Course/Community/Placement Test Attributes File','Create_Course',undef,'Create_Courses');
1.90 raeburn 875: my $end_page =
876: &Apache::loncommon::end_page();
877: $r->print($start_page.$crumbs);
1.159 raeburn 878: $r->print('<h3>'.&mt('Upload a courses, communities or placement tests attributes file').'</h3>');
1.90 raeburn 879: $r->print('<form name="batchcreate" method="post" '.
880: 'enctype="multipart/form-data" action="/adm/createcourse">'.
881: '<input type="file" name="coursecreatorxml" />'.
1.121 bisitz 882: '<input type="hidden" name="phase" value="batchtwo" /><br /><br />'.
1.90 raeburn 883: '<input type="submit" name="batchsubmit" '.
1.159 raeburn 884: 'value="'.&mt('Create Courses/Communities/Placement Tests').'" /></form>');
1.90 raeburn 885: $r->print($end_page);
886: return;
887: }
888:
889: sub process_batchfile {
890: my $r = shift;
891: my $start_page =
1.159 raeburn 892: &Apache::loncommon::start_page('Create a New Course, Community or Placement Test');
1.90 raeburn 893: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Outcome','Create_Course',undef,'Create_Courses');
894: my $end_page =
895: &Apache::loncommon::end_page();
896: my $defdom=$env{'request.role.domain'};
897: my $batchfilepath=&Apache::lonnet::userfileupload('coursecreatorxml',undef,
898: 'batchupload',undef,undef,
899: undef,undef,$defdom);
900: my ($batchdir,$filename) = ($batchfilepath =~ m-^(.+)/pending/([^/]+)$-);
901: my ($result,$logmsg);
902: if (-e "$batchfilepath") {
903: open(FILE,"<$batchfilepath");
904: my @buffer = <FILE>;
905: close(FILE);
906: if ((defined($filename)) && (defined($batchdir))) {
907: my @requests = ($filename);
908: my %courseids = ();
909: ($result,$logmsg) = &LONCAPA::batchcreatecourse::create_courses(
910: \@requests,\%courseids,'web',$defdom,
911: $env{'user.name'},$env{'user.domain'});
912: if ($result) {
913: if (!-e "$batchdir/processed") {
914: mkdir("$batchdir/processed", 0755);
915: open(FILE,">$batchdir/processed/$filename");
916: print FILE @buffer;
917: close(FILE);
918: if (-e "$batchdir/processed/$filename") {
919: unlink("$batchdir/pending/$filename");
920: }
921: }
922: }
923: }
924: }
1.103 raeburn 925: $r->print($start_page.$crumbs.$logmsg.$result.'<br /><a href="/adm/createcourse">'.
926: &mt('Creation options menu').'</a>'.$end_page);
1.90 raeburn 927:
928: }
929:
1.126 raeburn 930: sub courserequestbrowser_javascript {
931: return <<"ENDREQBRW";
932: <script type="text/javascript">
933: // <![CDATA[
934: var steditbrowser;
1.136 raeburn 935: function opencoursereqdisplay(cdom,cnum,queue) {
1.126 raeburn 936: var url = '/adm/requestcourse?action=display';
1.136 raeburn 937: url += '&showdom='+cdom+'&cnum='+cnum+'&queue='+queue;
1.126 raeburn 938: var title = 'Course_Request_Browser';
939: var options = 'scrollbars=1,resizable=1,menubar=0';
940: options += ',width=700,height=600';
941: var stdeditbrowser = open(url,title,options,'1');
942: stdeditbrowser.focus();
943: }
1.136 raeburn 944:
1.126 raeburn 945: // ]]>
946: </script>
947: ENDREQBRW
948: }
949:
1.127 raeburn 950: sub print_creation_logs {
951: my ($r) = @_;
952: my $formname = 'creationlog';
953: my $dom = $env{'request.role.domain'};
954: $r->print('<form action="/adm/createcourse" method="post" name="'.$formname.'">');
955: # set defaults
956: my $now = time();
957: my $defstart = $now - (7*24*3600); #7 days ago
958: my %defaults = (
959: page => '1',
960: show => '10',
961: type => 'any',
962: context => 'any',
963: created_before_date => $now,
964: created_after_date => $defstart,
965: );
966: my ($contexts,$contextnames) = &context_names();
967: my $more_records = 0;
968: my %curr;
969: foreach my $item ('show','page','type','context') {
970: $curr{$item} = $env{'form.'.$item};
971: }
972: $curr{'created_after_date'} = &Apache::lonhtmlcommon::get_date_from_form('created_after_date');
973: $curr{'created_before_date'} = &Apache::lonhtmlcommon::get_date_from_form('created_before_date');
974: foreach my $key (keys(%defaults)) {
975: if ($curr{$key} eq '') {
976: $curr{$key} = $defaults{$key};
977: }
978: }
1.135 raeburn 979: my %whodunit;
980: $r->print(&creation_display_filter($formname,\%curr));
1.127 raeburn 981: my $showntablehdr = 0;
982: my $tablehdr = &Apache::loncommon::start_data_table().
983: &Apache::loncommon::start_data_table_header_row().
984: '<th> </th><th>'.&mt('Creation Date').'</th>'.
985: '<th>'.&mt('Creator').'</th><th>'.&mt('Description').'</th>'.
1.131 raeburn 986: '<th>'.&mt('Owner(s)').'</th>';
1.127 raeburn 987: if (($curr{'type'} eq 'official') || ($curr{'type'} eq 'any')) {
988: $tablehdr .= '<th>'.&mt('Institutional Code').'</th>';
1.128 raeburn 989: }
990: if ($curr{'type'} eq 'any') {
991: $tablehdr .= '<th>'.&mt('Course Type').'</th>';
992: }
1.129 raeburn 993: if ($curr{'context'} eq 'any') {
1.128 raeburn 994: $tablehdr .= '<th>'.&mt('Creation Context').'</th>';
995: }
996: $tablehdr .= &Apache::loncommon::end_data_table_header_row();
1.127 raeburn 997: my ($minshown,$maxshown);
998: $minshown = 1;
999: my $count = 0;
1000: if ($curr{'show'} ne &mt('all')) {
1001: $maxshown = $curr{'page'} * $curr{'show'};
1002: if ($curr{'page'} > 1) {
1003: $minshown = 1 + ($curr{'page'} - 1) * $curr{'show'};
1004: }
1005: }
1006: my $crstype = 'Course';
1007: if ($curr{'type'} eq 'any') {
1008: $crstype = '.';
1009: } elsif ($curr{'type'} eq 'community') {
1010: $crstype = 'Community';
1.159 raeburn 1011: } elsif ($curr{'type'} eq 'placement') {
1012: $crstype = 'Placement';
1.127 raeburn 1013: }
1014:
1015: my ($instcodefilter,$regexpok);
1016: my (@codetitles,%cat_titles,%cat_order,%cat_items,$officialjs);
1017: my ($jscript,$totcodes,$numtitles,$lasttitle) =
1018: &Apache::courseclassifier::instcode_selectors_data($dom,$formname,
1019: \%cat_items,\@codetitles,\%cat_titles,\%cat_order,
1020: $officialjs);
1021: if ($numtitles) {
1022: if (($curr{'type'} eq 'official') || ($curr{'type'} eq 'unofficial')) {
1023: $instcodefilter = &instcode_srchstr($dom,$numtitles);
1.141 raeburn 1024: &Apache::courseclassifier::instcode_search_str($dom,$numtitles,\@codetitles);
1.127 raeburn 1025: if ($curr{'type'} eq 'official') {
1026: $regexpok = 1;
1027: } else {
1028: unless ($instcodefilter eq '') {
1029: $regexpok = -1;
1030: }
1031: }
1032: }
1033: }
1034: if ($instcodefilter eq '') { $instcodefilter = '.'; }
1035:
1036: my $creationcontext = '.';
1037: my $context_regexp = join('|',@{$contexts});
1038: if ($curr{'context'} =~ /^($context_regexp)$/) {
1039: $creationcontext = $curr{'context'};
1040: }
1041: my %courses =
1042: &Apache::lonnet::courseiddump($dom,'.',1,$instcodefilter,'.','.',undef,undef,
1043: $crstype,$regexpok,undef,undef,'1','creationlog',
1044: undef,undef,undef,$curr{'created_before_date'},
1045: $curr{'created_after_date'},$creationcontext);
1046: foreach my $cid (sort { $courses{$b}{'created'}<=>$courses{$a}{'created'} } (keys(%courses))) {
1.136 raeburn 1047: if ($curr{'show'} ne &mt('all')) {
1048: if ($count >= $curr{'page'} * $curr{'show'}) {
1049: $more_records = 1;
1050: last;
1051: }
1052: }
1.127 raeburn 1053: $count ++;
1054: next if ($count < $minshown);
1055: if (!$showntablehdr) {
1056: $r->print($tablehdr);
1057: $showntablehdr = 1;
1058: }
1059: if ($courses{$cid}{'creator'} ne '') {
1060: if ($whodunit{$courses{$cid}{'creator'}} eq '') {
1061: my ($uname,$udom) = split(':',$courses{$cid}{'creator'});
1062: $whodunit{$courses{$cid}{'creator'}} =
1063: &Apache::loncommon::plainname($uname,$udom);
1064: }
1065: }
1066: my $description = $courses{$cid}{'description'};
1067: my @owners;
1068: my $singleowner = $courses{$cid}{'owner'};
1069: push(@owners,$singleowner);
1070: if (ref($courses{$cid}{'co-owners'}) eq 'ARRAY') {
1071: foreach my $item (@{$courses{$cid}{'co-owners'}}) {
1072: push(@owners,$item);
1073: }
1074: }
1075: my %ownernames;
1076: foreach my $owner (@owners) {
1077: my ($ownername,$ownerdom);
1078: if ($owner =~ /:/) {
1079: ($ownername,$ownerdom) = split(/:/,$owner);
1080: } else {
1081: $ownername = $owner;
1082: if ($owner ne '') {
1083: $ownerdom = $dom;
1084: }
1085: }
1086: if ($ownername ne '' && $ownerdom ne '') {
1087: unless (ref($ownernames{$ownername.':'.$ownerdom}) eq 'HASH') {
1088: my %namehash=&Apache::loncommon::getnames($ownername,$ownerdom);
1089: $ownernames{$ownername.':'.$ownerdom} = \%namehash;
1090: }
1091: }
1092: }
1093: my @lastnames;
1094: foreach my $owner (keys(%ownernames)) {
1095: if (ref($ownernames{$owner}) eq 'HASH') {
1096: push(@lastnames,$ownernames{$owner}{'lastname'});
1097: }
1098: }
1099: my $ownerlastnames = join(', ',sort(@lastnames));
1100: my $showtype;
1101: if ($courses{$cid}{type} eq 'Community') {
1102: $showtype = &mt('community');
1.159 raeburn 1103: } elsif ($courses{$cid}{type} eq 'Placement') {
1104: $showtype = &mt('placement test');
1.127 raeburn 1105: } else {
1106: my $instcode = $courses{$cid}{inst_code};
1107: if ($instcode ne '') {
1108: $showtype = &mt('official');
1109: } else {
1110: $showtype = &mt('unofficial');
1111: }
1112: }
1113: my $showcontext;
1114:
1115: if ($courses{$cid}{context} =~ /^($context_regexp)$/) {
1116: $showcontext = $contextnames->{$courses{$cid}{context}};
1117: }
1118: my $created = &Apache::lonlocal::locallocaltime($courses{$cid}{'created'});
1119: my ($cdom,$cnum) = split('_',$cid);
1120: $r->print(&Apache::loncommon::start_data_table_row()."\n".
1121: '<td>'.$count.'</td><td>'.$created.'</td>'."\n".
1122: '<td>'.$whodunit{$courses{$cid}{creator}}.'</td>'."\n".
1123: '<td>'.$description.' <a href="javascript:ToSyllabus('."'$cdom','$cnum'".')">'.&mt('Syllabus').'</a></td><td>'.$ownerlastnames.'</td>');
1124: if (($curr{'type'} eq 'official') || ($curr{'type'} eq 'any')) {
1125: $r->print('<td>'.$courses{$cid}{'inst_code'}.'</td>');
1126: }
1.128 raeburn 1127: if ($curr{'type'} eq 'any') {
1128: $r->print('<td>'.$showtype.'</td>');
1129: }
1130: if ($curr{'context'} eq 'any') {
1131: $r->print('<td>'.$showcontext.'</td>');
1132: }
1133: $r->print('<td>'.&Apache::loncommon::end_data_table_row()."\n");
1.127 raeburn 1134: }
1135: if ($showntablehdr) {
1136: $r->print(&Apache::loncommon::end_data_table().'<br />');
1137: if (($curr{'page'} > 1) || ($more_records)) {
1138: $r->print('<table><tr>');
1139: if ($curr{'page'} > 1) {
1140: $r->print('<td><a href="javascript:chgPage('."'previous'".');">'.&mt('Previous [_1] changes',$curr{'show'}).'</a></td>');
1141: }
1142: if ($more_records) {
1143: $r->print('<td><a href="javascript:chgPage('."'next'".');">'.&mt('Next [_1] changes',$curr{'show'}).'</a></td>');
1144: }
1145: $r->print('</tr></table>');
1146: $r->print(<<"ENDSCRIPT");
1147: <script type="text/javascript">
1148: // <![CDATA[
1149: function chgPage(caller) {
1150: if (caller == 'previous') {
1151: document.$formname.page.value --;
1152: }
1153: if (caller == 'next') {
1154: document.$formname.page.value ++;
1155: }
1156: document.$formname.submit();
1157: return;
1158: }
1159: // ]]>
1160: </script>
1161: ENDSCRIPT
1162: }
1163: } else {
1164: $r->print('<p class="LC_info">'.
1165: &mt('There are no records to display').
1166: '</p>');
1167: }
1168: $r->print('<input type="hidden" name="page" value="'.$curr{'page'}.'" />'.
1169: '<input type="hidden" name="phase" value="creationlog" /></form>');
1170: return;
1171: }
1172:
1173: sub creation_display_filter {
1.135 raeburn 1174: my ($formname,$curr) = @_;
1.127 raeburn 1175: my $nolink = 1;
1176: my ($contexts,$contextnames) = &context_names();
1177: my $output = '<table><tr><td valign="top">'.
1178: '<span class="LC_nobreak"><b>'.&mt('Records/page:').'</b></span><br />'.
1179: &Apache::lonmeta::selectbox('show',$curr->{'show'},undef,
1180: (&mt('all'),5,10,20,50,100,1000,10000)).
1181: '</td><td> </td>';
1182: my $startform =
1183: &Apache::lonhtmlcommon::date_setter($formname,'created_after_date',
1184: $curr->{'created_after_date'},undef,
1185: undef,undef,undef,undef,undef,undef,$nolink);
1186: my $endform =
1187: &Apache::lonhtmlcommon::date_setter($formname,'created_before_date',
1188: $curr->{'created_before_date'},undef,
1189: undef,undef,undef,undef,undef,undef,$nolink);
1.136 raeburn 1190: $output .= '<td valign="top"><b>'.&mt('Window during which course/community was created:').'</b><br />'.
1.127 raeburn 1191: '<table><tr><td>'.&mt('After:').
1192: '</td><td>'.$startform.'</td></tr>'.
1193: '<tr><td>'.&mt('Before:').'</td>'.
1194: '<td>'.$endform.'</td></tr></table>'.
1195: '</td>'.
1196: '<td> </td>';
1.136 raeburn 1197: my ($types,$typenames) = &Apache::loncommon::course_types();
1.127 raeburn 1198: if (ref($types) eq 'ARRAY') {
1199: if (@{$types} > 1) {
1200: $output .= '<td valign="top"><b>'.
1201: &mt('Course Type:').'</b><br /><select name="type">';
1202: my $selstr = '';
1203: if ($curr->{'type'} eq 'any') {
1204: $selstr = ' selected="selected"';
1205: }
1206: $output .= '<option value="any"'.$selstr.'>'.&mt('Any').'</option>'."\n";
1207: foreach my $type (@{$types}) {
1208: my $selstr = '';
1209: if ($curr->{'type'} eq $type) {
1210: $selstr = ' selected="selected"';
1211: }
1212: my $typename = $type;
1213: if (ref($typenames) eq 'HASH') {
1214: if ($typenames->{$type} ne '') {
1215: $typename = $typenames->{$type};
1216: }
1217: }
1.155 bisitz 1218: $output .= '<option value="'.$type.'"'.$selstr.'>'.&mt($typename).'</option>'."\n";
1.127 raeburn 1219: }
1220: $output .= '</select></td>';
1221: }
1222: }
1223: $output .= '<td> </td>'.
1224: '<td valign="top"><b>'.
1225: &mt('Creation Context:').'</b><br /><select name="context">';
1226: foreach my $context ('any',@{$contexts}) {
1227: my $selstr = '';
1228: if ($curr->{'context'} eq $context) {
1229: $selstr = ' selected="selected"';
1230: }
1231: $output .= '<option value="'.$context.'"'.$selstr.'>';
1232: if ($context eq 'any') {
1233: $output .= &mt('Any');
1234: } else {
1235: $output .= $contextnames->{$context};
1236: }
1237: $output .= '</option>'."\n";
1238: }
1239: $output .= '</select></td>'.
1240: '</tr></table>';
1241:
1242: # Update Display button
1243: $output .= '<p>'.
1244: '<input type="submit" value="'.&mt('Update Display').'" />'.
1.135 raeburn 1245: '</p><hr />';
1.127 raeburn 1246: return $output;
1247: }
1248:
1249: sub context_names {
1.128 raeburn 1250: my @contexts = qw(auto web dc_create requestcourses);
1.127 raeburn 1251: my %contextnames =
1252: &Apache::lonlocal::texthash (
1.128 raeburn 1253: auto => 'Automated creation from batch file',
1254: web => 'Batch creation from uploaded file',
1.131 raeburn 1255: dc_create => 'Course or community created by Dom. Coord.',
1.128 raeburn 1256: requestcourses => 'Processing of submitted course request',
1.127 raeburn 1257: );
1258: return (\@contexts,\%contextnames);
1259: }
1260:
1261: sub instcode_srchstr {
1262: my ($domain,$numtitles) = @_;
1263: my $instcode;
1264: if (defined($numtitles) && $numtitles == 0) {
1265: $instcode = '.+';
1266: } else {
1267: my (%codedefaults,@code_order);
1268: my $defaults_result =
1269: &Apache::lonnet::auto_instcode_defaults($domain,\%codedefaults,
1270: \@code_order);
1271: if ($defaults_result eq 'ok') {
1272: $instcode ='^';
1273: foreach my $item (@code_order) {
1274: $instcode .= $codedefaults{$item};
1275: }
1276: $instcode .= '$';
1277: } else {
1278: $instcode = '.+';
1279: }
1280: }
1281: return $instcode;
1282: }
1283:
1284: sub syllabuslink_javascript {
1285: return <<"ENDJS";
1286:
1287: function ToSyllabus(cdom,cnum) {
1288: if (cdom == '' || cdom == null) {
1289: return;
1290: }
1291: if (cnum == '' || cnum == null) {
1292: return;
1293: }
1294: var options = 'height=600,width=800,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no';
1295: var url = "/public/"+cdom+"/"+cnum+"/syllabus";
1296: syllwin = window.open(url,'',options,1);
1297: syllwin.focus();
1298: return;
1299: }
1300:
1301: ENDJS
1302:
1303: }
1.126 raeburn 1304:
1.164 ! raeburn 1305: sub get_permission {
! 1306: my ($dom) = @_;
! 1307: my ($allowed,%permission);
! 1308: if (&Apache::lonnet::allowed('ccc',$dom)) {
! 1309: $allowed = 1;
! 1310: %permission = (
! 1311: create => 1,
! 1312: );
! 1313: } elsif (&Apache::lonnet::allowed('dcc',$dom)) {
! 1314: $allowed = 1;
! 1315: }
! 1316: return ($allowed,\%permission);
! 1317: }
! 1318:
1.2 www 1319: # ===================================================================== Handler
1.1 www 1320: sub handler {
1321: my $r = shift;
1322:
1323: if ($r->header_only) {
1.38 www 1324: &Apache::loncommon::content_type($r,'text/html');
1.1 www 1325: $r->send_http_header;
1326: return OK;
1327: }
1328:
1.164 ! raeburn 1329: my ($allowed,$permission) = &get_permission($env{'request.role.domain'});
! 1330: if ($allowed) {
! 1331: my $show_all_choices = 0;
! 1332: my $primary_rev = &Apache::lonnet::get_server_loncaparev($env{'request.role.domain'});
! 1333: my %cancreate = (
! 1334: Community => 0,
! 1335: Placement => 0,
! 1336: );
! 1337: if (($primary_rev ne 'refused') && ($primary_rev ne 'error') &&
! 1338: ($primary_rev ne 'unknown_cmd') && ($primary_rev ne 'no_such_host')) {
! 1339: $show_all_choices = 1;
! 1340: my ($primary_major,$primary_minor) = split(/\./,$primary_rev);
! 1341: foreach my $key (keys(%cancreate)) {
! 1342: my ($needsmajor,$needsminor) =
! 1343: split(/\./,$Apache::lonnet::needsrelease{'course:crstype:'.$key});
! 1344: unless (($needsmajor > $primary_major) ||
! 1345: (($needsmajor == $primary_major) && ($needsminor > $primary_minor))) {
! 1346: $cancreate{$key} = 1;
! 1347: }
1.159 raeburn 1348: }
1349: }
1.137 raeburn 1350:
1.38 www 1351: &Apache::loncommon::content_type($r,'text/html');
1.1 www 1352: $r->send_http_header;
1353:
1.90 raeburn 1354: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
1355: ['phase']);
1356: &Apache::lonhtmlcommon::clear_breadcrumbs();
1357: &Apache::lonhtmlcommon::add_breadcrumb
1358: ({href=>"/adm/createcourse",
1359: text=>"Creation Options",
1360: faq=>79,bug=>'Dom Coord Interface',});
1.164 ! raeburn 1361: if (($permission->{'create'}) &&
! 1362: (($env{'form.phase'} eq 'coursetwo') ||
! 1363: (($env{'form.phase'} eq 'grouptwo') &&
1.159 raeburn 1364: ($cancreate{'Community'})) ||
1365: (($env{'form.phase'} eq 'placementtwo') &&
1.164 ! raeburn 1366: ($cancreate{'Placement'})))) {
1.90 raeburn 1367: &Apache::lonhtmlcommon::add_breadcrumb
1368: ({href=>"/adm/createcourse?phase=$env{'form.prevphase'}",
1369: text=>&mt('[_1] Creation Settings',),
1370: faq=>9,bug=>'Dom Coord Interface',});
1371: &Apache::lonhtmlcommon::add_breadcrumb
1372: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1373: text=>"Creation Outcome",
1374: faq=>9,bug=>'Dom Coord Interface',});
1.10 matthew 1375: &create_course($r);
1.164 ! raeburn 1376: } elsif (($permission->{'create'}) &&
! 1377: (($env{'form.phase'} eq 'courseone') ||
! 1378: (($env{'form.phase'} eq 'groupone') &&
! 1379: ($cancreate{'Community'})) ||
! 1380: (($env{'form.phase'} eq 'placementone') &&
! 1381: ($cancreate{'Placement'})))) {
1.90 raeburn 1382: &Apache::lonhtmlcommon::add_breadcrumb
1383: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1384: text=>&mt('[_1] Creation Settings',),
1385: faq=>9,bug=>'Dom Coord Interface',});
1386: &print_course_creation_page($r);
1.164 ! raeburn 1387: } elsif (($permission->{'create'}) &&
! 1388: ($env{'form.phase'} eq 'batchone')) {
1.90 raeburn 1389: &Apache::lonhtmlcommon::add_breadcrumb
1390: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1391: text=>"Upload Description File",
1392: faq=>9,bug=>'Dom Coord Interface',});
1393: &upload_batchfile($r);
1.164 ! raeburn 1394: } elsif (($permission->{'create'}) &&
! 1395: ($env{'form.phase'} eq 'batchtwo')) {
1.90 raeburn 1396: &Apache::lonhtmlcommon::add_breadcrumb
1397: ({href=>"/adm/createcourse?phase=$env{'form.prevphase'}",
1398: text=>"Upload Description File",
1399: faq=>9,bug=>'Dom Coord Interface',});
1400: &Apache::lonhtmlcommon::add_breadcrumb
1401: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1402: text=>"Creation Outcome",
1403: faq=>9,bug=>'Dom Coord Interface',});
1404: &process_batchfile($r);
1.137 raeburn 1405: } elsif (($env{'form.phase'} eq 'requestdisplay') && ($show_all_choices)) {
1.125 raeburn 1406: &Apache::lonhtmlcommon::add_breadcrumb
1407: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1408: text=>&mt('[_1] Display Request Queue',),
1409: faq=>9,bug=>'Dom Coord Interface',});
1.126 raeburn 1410: my $js = &courserequestbrowser_javascript();
1411: my $start_page=&Apache::loncommon::start_page('Display Requests',$js);
1.156 bisitz 1412: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Display Requests','Course_Requests',undef,'Course_Requests');
1.164 ! raeburn 1413: my $context = 'domain';
! 1414: unless ($permission->{'create'}) {
! 1415: $context = 'helpdesk';
! 1416: }
1.125 raeburn 1417: $r->print($start_page.$crumbs."\n".'<div>'.
1418: &Apache::loncoursequeueadmin::display_queued_requests(
1.164 ! raeburn 1419: $context,$env{'request.role.domain'},undef,).'</div>'.
1.125 raeburn 1420: &Apache::loncommon::end_page());
1.164 ! raeburn 1421: } elsif (($permission->{'create'}) &&
! 1422: ($env{'form.phase'} eq 'requestchange') && ($show_all_choices)) {
1.136 raeburn 1423: if ($env{'form.queue'} eq 'pending') {
1424: &Apache::lonhtmlcommon::add_breadcrumb
1425: ({href=>"/adm/createcourse?phase=pendingdisplay",
1426: text=>&mt('Display Pending Queue',),
1427: faq=>9,bug=>'Dom Coord Interface',});
1428: } else {
1429: &Apache::lonhtmlcommon::add_breadcrumb
1430: ({href=>"/adm/createcourse?phase=requestdisplay",
1431: text=>&mt('[_1] Display Request Queue',),
1432: faq=>9,bug=>'Dom Coord Interface',});
1433: }
1.125 raeburn 1434: &Apache::lonhtmlcommon::add_breadcrumb
1.136 raeburn 1435: ({href=>"/adm/createcourse?phase=requestchange",
1436: text=>&mt('[_1] Requests Updated',),
1437: faq=>9,bug=>'Dom Coord Interface',},);
1.125 raeburn 1438: my $start_page=&Apache::loncommon::start_page('Update Requests Result');
1.156 bisitz 1439: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Requests Updated','Course_Requests',undef,'Course_Requests');
1.125 raeburn 1440: $r->print($start_page.$crumbs."\n".'<div>'.
1441: &Apache::loncoursequeueadmin::update_request_queue(
1442: 'domain',$env{'request.role.domain'}).'</div>'.
1443: &Apache::loncommon::end_page());
1.137 raeburn 1444: } elsif (($env{'form.phase'} eq 'pendingdisplay') && ($show_all_choices)) {
1.136 raeburn 1445: &Apache::lonhtmlcommon::add_breadcrumb
1446: ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
1447: text=>&mt('Display Pending Queue',),
1448: faq=>9,bug=>'Dom Coord Interface',});
1449: my $js = &courserequestbrowser_javascript();
1450: my $start_page=&Apache::loncommon::start_page('Display Pending Queue',$js);
1.156 bisitz 1451: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Display Pending Queue','Course_Requests',undef,'Course_Requests');
1.164 ! raeburn 1452: my $context = 'pending';
! 1453: unless ($permission->{'create'}) {
! 1454: $context = 'displaypending';
! 1455: }
1.136 raeburn 1456: $r->print($start_page.$crumbs."\n".'<div>'.
1457: &Apache::loncoursequeueadmin::display_queued_requests(
1.164 ! raeburn 1458: $context,$env{'request.role.domain'}).'</div>'.
1.136 raeburn 1459: &Apache::loncommon::end_page());
1.164 ! raeburn 1460: } elsif (($permission->{'create'}) &&
! 1461: ($env{'form.phase'} eq 'requestvalidation') && ($show_all_choices)) {
1.136 raeburn 1462: my $js = &courserequestbrowser_javascript();
1463: &Apache::lonhtmlcommon::add_breadcrumb
1464: ({href=>"/adm/createcourse?phase=pendingdisplay",
1465: text=>&mt('Display Pending Queue'),},
1466: {href=>"/adm/createcourse?phase=requestvalidation",
1467: text=>&mt('Validation Attempted'),},);
1468: my $start_page=&Apache::loncommon::start_page('Requests Validation Result',$js);
1.156 bisitz 1469: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Validation Attempted','Course_Requests',undef,'Course_Requests');
1.136 raeburn 1470: $r->print($start_page.$crumbs."\n".'<div>'.
1471: &Apache::loncoursequeueadmin::process_official_reqs('domain',$env{'request.role.domain'}).'</div>'.
1472: &Apache::loncommon::end_page());
1.137 raeburn 1473: } elsif (($env{'form.phase'} eq 'creationlog') && ($show_all_choices)) {
1.127 raeburn 1474: &Apache::lonhtmlcommon::add_breadcrumb
1475: ({href=>"/adm/createcourse?phase=creationlog",
1476: text=>&mt('[_1] Display Creation History',),});
1477: my $js = '<script type="text/javascript">'."\n".
1478: '// <![CDATA['."\n".
1479: &syllabuslink_javascript()."\n".
1480: '// ]]>'."\n".
1481: '</script>';
1.131 raeburn 1482: my $start_page=&Apache::loncommon::start_page('Course/Community Creation Logs',$js);
1.151 raeburn 1483: my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Created Courses/Communities','Course_Creation_Log',undef,'Course_Creation_Log');
1.127 raeburn 1484: $r->print($start_page.$crumbs."\n".'<div>');
1485: &print_creation_logs($r);
1486: $r->print('</div>'.&Apache::loncommon::end_page());
1.2 www 1487: } else {
1.164 ! raeburn 1488: &print_intro_page($r,$show_all_choices,\%cancreate,$permission);
1.2 www 1489: }
1.1 www 1490: } else {
1.78 albertel 1491: $env{'user.error.msg'}=
1.127 raeburn 1492: "/adm/createcourse:ccc:0:0:Cannot create courses or communities";
1.1 www 1493: return HTTP_NOT_ACCEPTABLE;
1494: }
1495: return OK;
1.90 raeburn 1496: }
1.1 www 1497:
1498: 1;
1499: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>