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