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