Annotation of loncom/imspackages/imsimportdocs.pm, revision 1.5
1.1 raeburn 1: package Apache::imsimportdocs;
2:
1.2 raeburn 3: use Apache::Constants qw(:common :http :methods);
1.1 raeburn 4: use Apache::lonnet;
1.2 raeburn 5: use Apache::londocs;
1.1 raeburn 6: use Apache::loncommon;
7: use Apache::lonlocal;
8: use Apache::imsprocessor;
9: use LONCAPA::Configuration;
1.2 raeburn 10: use strict;
1.1 raeburn 11:
12: sub jscript_one {
13: my $javascript = shift;
14: $$javascript = qq#
15: function verify() {
16: if ((document.forms.pickcms.uploadname.value == '') || (!document.forms.pickcms.uploadname.value)) {
17: alert("You must provide the name of the IMS package to be imported")
18: return false
19: }
20: if (document.forms.pickcms.source.selectedIndex == 0) {
21: alert("You must choose the Course Management System from which the IMS package was exported");
22: return false
23: }
24: return true
25: }
26:
27: function nextPage() {
28: if (verify()) {
29: document.forms.pickcms.submit()
30: }
31: }
32: #;
33:
34: }
35:
36: sub jscript_two {
37: my $javascript = shift;
38: $$javascript = qq#
39: function setOptions(caller,itemnum) {
40: var opForm = document.forms.pickoptions
41: var menu = 1 + itemnum*2
42: opForm.elements[menu].length = 0
43: if (opForm.elements[itemnum*2].checked == true) {
44: if (caller == "board") {
45: opForm.elements[menu].options[0] = new Option("Select","-1",true,true)
46: opForm.elements[menu].options[1] = new Option("Import topics only","topics",true,true)
1.4 raeburn 47: opForm.elements[menu].options[2] = new Option("Import topics + posts (with author)","allpost",true,true)
48: opForm.elements[menu].options[3] = new Option("Import topics + posts (no author)","allanon",true,true)
1.1 raeburn 49: }
50: else {
51: if (caller == "users") {
52: opForm.elements[menu].length = 0
53: opForm.elements[menu].options[0] = new Option("Select","-1",true,true)
54: opForm.elements[menu].options[1] = new Option("Enroll students only","students",true,true)
55: opForm.elements[menu].options[2] = new Option("Enroll all users","all",true,true)
56: }
57: }
58: }
59: else {
60: opForm.elements[menu].options[0] = new Option("Not required","0",true,true)
61: }
62: opForm.elements[menu].selectedIndex = 0
63: }
64:
65: function verify(caller) {
66: var opForm = document.forms.pickoptions
67: var totcheck = 0;
68: for (var i=0; i<caller; i++) {
69: if (opForm.elements[2*i].checked == true) {
70: totcheck ++
71: if (opForm.elements[2*i].name == "board") {
72: if (opForm.elements[2*i+1].selectedIndex == 0) {
73: alert("You must select one of the additional options when importing Discussion Boards ")
74: return false
75: }
76: }
77: if (opForm.elements[2*i].name == "users") {
78: if (opForm.elements[2*i+1].selectedIndex == 0) {
79: alert("You must select one of the additional options when importing Enrollment")
80: return false
81: }
82: }
83: }
84: }
85: if (totcheck == 0) {
86: alert("You must check the Checkbox for at least one Content Type");
87: return false
88: }
89: return true
90: }
91:
92: function nextPage(caller) {
93: if (verify(caller)) {
94: document.forms.pickoptions.submit()
95: }
96: }
97: #;
98: }
99:
1.2 raeburn 100: sub jscript_three {
101: my $javascript = shift;
102: $$javascript = qq|
103: function init(tf) {
104: setTimeout("self.close()",3000)
105: tf.submit();
106: }
107: |;
108: }
109:
1.1 raeburn 110: sub handler {
111: my $r = shift;
112: my $javascript = '';
113: &Apache::loncommon::content_type($r,'text/html');
114: $r->send_http_header;
115: return OK if $r->header_only;
116:
1.3 raeburn 117: my @areas = ();
1.1 raeburn 118: my %cmsmap = ();
1.3 raeburn 119: my %areaname = ();
120: &Apache::imsprocessor::ims_config(\@areas,\%cmsmap,\%areaname);
1.1 raeburn 121:
122: # get course data
123: my $coursenum=$ENV{'course.'.$ENV{'request.course.id'}.'.num'};
124: my $coursedom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
125: my $coursehome=$ENV{'course.'.$ENV{'request.course.id'}.'.home'};
126:
127: # get personal data
128:
129: my $uname=$ENV{'user.name'};
130: my $udom=$ENV{'user.domain'};
131: my $plainname=&Apache::lonnet::escape(
132: &Apache::loncommon::plainname($uname,$udom));
133:
134: # does this user have privileges to post, etc?
135: my $allowed=&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'});
136: unless ($allowed) {
137: $r->print("<html><head><title>The LearningOnline Network with CAPA</title></head>");
138: $r->print(&Apache::loncommon::bodytag('Import IMS package'));
139: $r->print('<h3>'.&mt('Modification of Course Contents Disallowed').'</h3>'.&mt('Your current role does not grant you the right to modify course content in this course.').'</body></html>');
140: return OK;
141: }
142:
143: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
144: ['phase']);
145:
146: if ($ENV{'form.phase'} eq 'one') {
147: &jscript_one(\$javascript);
148: } elsif ($ENV{'form.phase'} eq 'two') {
149: &jscript_two(\$javascript);
1.2 raeburn 150: } elsif ($ENV{'form.phase'} eq 'three') {
151: &jscript_three(\$javascript);
1.1 raeburn 152: }
153:
154: # print screen
155: $r->print(<<ENDHEAD);
156: <html>
157: <head>
158: <title>The LearningOnline Network with CAPA</title>
159: <script type="text/javascript">
160: <!--
161: $javascript
162: -->
163: </script>
164: </head>
165: ENDHEAD
166: # -------------------------------------------------------------------- Body tag
167: $r->print(&Apache::loncommon::bodytag('Import IMS package'));
168: if ($ENV{'form.phase'} eq 'one') {
169: &display_one($r);
170: } elsif ($ENV{'form.phase'} eq 'two') {
1.3 raeburn 171: &display_two($r,$coursenum,\@areas,\%areaname,%cmsmap);
1.1 raeburn 172: } elsif ($ENV{'form.phase'} eq 'three') {
1.2 raeburn 173: &display_three($r,$coursenum,$coursedom,$coursehome,$uname,$udom,\@areas,%cmsmap);
1.1 raeburn 174: }
175: $r->print("</body><html>");
1.2 raeburn 176: return OK;
1.1 raeburn 177: }
178:
179:
180: sub display_one {
1.2 raeburn 181: my ($r) = @_;
1.1 raeburn 182: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folder']);
183:
184: $r->print(<<ENDBLOCK);
185: <form action="/adm/imsimportdocs" method="post" enctype="multipart/form-data" name="pickcms">
186: <table border='0' bgcolor='#F6F6F6' cellspacing='0' cellpadding ='0' width='100%'>
187: <tr>
188: <td colspan='2'>
189: <table border='0' cellspacing='0' cellpadding='0'>
190: <tr>
191: <td colspan='2' align='left'>
192: </td>
193: </tr>
194: <tr bgcolor='#CCCCFF'>
195: <td valign='middle'><img src='/res/adm/pages/bl_step1.gif'>
196: </td>
197: <td width='100%' align='left'>
198: <font face='arial,helvetica,sans-serif'><b>Specify the Course Management system used to create the package.</b>
199: </font>
200: </td>
201: </tr>
202: <tr>
203: <td colspan='2'> </td>
204: </tr>
205: <tr>
206: <td> </td>
207: <td>
208: <font face='Arial,Helvetica,sans-serif'>
209: Please choose the CMS used to create your IMS content package.
210: <select name="source">
211: <option value='-1' selected="true">Please select
212: <option value='bb5'>Blackboard 5
213: <option value='angel'>ANGEL
214: </select>
215: </font>
216: </td>
217: </tr>
218: <tr>
219: <td colspan='2'> </td>
220: </tr>
221: <tr>
222: <td colspan='2'> </td>
223: </tr>
224: <tr bgcolor='#CCCCFF'>
225: <td valign='middle'><img src='/res/adm/pages/bl_step2.gif'>
226: </td>
227: <td width='100%' align='left'>
228: <font face='arial,helvetica,sans-serif'><b>Locate the IMS content package you wish to upload.</b>
229: </font>
230: </td>
231: </tr>
232: <tr>
233: <td colspan='2'> </td>
234: </tr>
235: <tr>
236: <td colspan='2'>
237: <input type="hidden" name="folder" value="$ENV{'form.folder'}" />
238: <input type="hidden" name="phase" value="two" />
239: <input type="file" name="uploadname" size="40" />
240: </td>
241: </tr>
242: <tr>
243: <td colspan='2'> </td>
244: </tr>
245: <tr>
246: <td> </td>
247: <td><font face='arial,helvetica,sans-serif'>If you have selected the CMS, and located the IMS package, you should click the 'Upload IMS package' button to upload the file to the server.</font></td>
248: </tr>
249: <tr>
250: <td colspan='2'> </td>
251: </tr>
252: <tr
253: <td colspan='2'>
254: <table border='0' cellspacing='0' cellpadding='0' width="100%">
255: <tr>
256: <td align='left'>
257: <input type="button" name="exitpage" value="Exit now" onClick="javascript:self.close()">
258: </td>
259: <td align='right'>
260: <input type="button" name="nextpage" value="Upload IMS package" onClick="javascript:nextPage()">
261: </td>
262: </tr>
263: </table>
264: </td>
265: </tr>
266: </table>
267: </td>
268: </tr>
269: </table>
270: </form>
271: ENDBLOCK
272: }
273:
274:
275: sub display_two {
1.3 raeburn 276: my ($r,$crs,$areasref,$areaname,%cmsmap) = @_;
1.1 raeburn 277: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folder','source']);
278: my $cms = $ENV{'form.source'};
1.2 raeburn 279: my $timenow = time;
280: my $tempdir = &Apache::imsprocessor::create_tempdir('DOCS',$crs,$timenow);
1.3 raeburn 281: my $fname = &Apache::imsprocessor::uploadzip('DOCS',$tempdir);
1.1 raeburn 282: my $unzip_result = '';
283: my $manifest_result = '';
284: unless ($tempdir eq '') {
285: $unzip_result = &Apache::imsprocessor::expand_zip($tempdir,$fname);
286: }
287: my %resources = ();
288: my %items = ();
289: my %hrefs = ();
1.2 raeburn 290: my %resinfo = ();
1.1 raeburn 291: my %count = ();
292: my @bgcolors = ("#eeeeee","#dddddd");
293:
294: my $counter = 0;
295: my $iter = 0;
296: my %count = (
297: announce => 0,
298: board => 0,
299: doc => 0,
300: extlink => 0,
301: msg => 0,
302: pool => 0,
303: quiz => 0,
304: staff => 0,
305: survey => 0,
306: users => 0,
307: );
308:
309: if ($unzip_result eq 'ok') {
1.2 raeburn 310: $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo);
1.1 raeburn 311: if ($manifest_result eq 'ok') {
312: foreach my $res (sort keys %resources) {
313: if ($cms eq 'bb5') {
314: foreach my $area (keys %{$cmsmap{$cms}}) {
315: if ($resources{$res}{type} eq $cmsmap{$cms}{$area}) {
316: $count{$area} ++;
317: }
318: }
319: } elsif ($cms eq 'angel') {
320: foreach my $area (keys %{$cmsmap{$cms}}) {
321: if ($area eq 'doc') {
322: if (grep/^$resources{$res}{type}$/,@{$cmsmap{$cms}{doc}}) {
323: $count{$area} ++;
324: }
325: } elsif ($resources{$res}{type} eq $cmsmap{$cms}{$area}) {
326: $count{$area} ++;
327: }
328: }
329: }
330: }
331: $r->print(<<ENDBLOCK);
332: <form name="pickoptions" method="post">
333: <table border='0' bgcolor='#F6F6F6'' cellspacing='0' cellpadding ='0' width='100%'>
334: <tr>
335: <td colspan='2'>
336: <table border='0' cellspacing='0' cellpadding='0'>
337: <tr>
338: <td colspan='2' align='left'>
339: </td>
340: </tr>
341: <tr bgcolor='#CCCCFF'>
342: <td valign='middle'><img src='/res/adm/pages/bl_step3.gif'>
343: </td>
344: <td width='100%' align='left'>
345: <font face='arial,helvetica,sans-serif'><b>Choose which content types you wish to import</b></font>
346: </td>
347: </tr>
348: <tr>
349: <td colspan='2'> </td>
350: </tr>
351: <tr>
352: <td> </td>
353: <td>
354: <table border='0' cellspacing='0' cellpadding='1' bgcolor='#000000'>
355: <tr>
356: <td>
357: <table border='0' cellspacing='0' cellpadding='0' bgcolor='#ffffff' width='100%'>
358: <tr>
359: <td>
360: <table border='0' cellspacing='1' cellpadding='1' bgcolor='#ffffff' width='100%'>
361: <tr bgcolor='#CCCCFF'>
362: <td align='center'><font face='arial,helvetica,sans-serif'><b>Import?</b></font></td>
363: <td align='center'><font face='arial,helvetica,sans-serif'><b>Content type</b></font></td>
364: <td align='center'><font face='arial,helvetica,sans-serif'><b>Additional options</b></font></td>
365: </tr>
366: ENDBLOCK
367: foreach my $area (@{$areasref}) {
368: if ($count{$area} > 0) {
369: my $count_tag = 'flag_'.$counter;
370: $r->print(" <tr bgcolor='@bgcolors[$iter]'>
371: <td align='left'><font face='arial,helvetica,sans-serif'><input name='$area' type='checkbox' ");
372: if ($area eq 'board' || $area eq 'users') {
373: $r->print(qq|onClick='javascript:setOptions("$area","$counter")'|);
374: }
375: $r->print("/></font></td>
1.3 raeburn 376: <td align='left'><font face='arial,helvetica,sans-serif'> $$areaname{$area} - $count{$area} item(s)</font></td>");
1.1 raeburn 377: if ($area eq 'board') {
378: $r->print(" <td align='left'><font face='arial,helvetica,sans-serif'>
1.2 raeburn 379: <select name='db_handling'>
1.1 raeburn 380: <option value='-2'><-- Check Import first
381: </select></font>
382: </td>");
383: } elsif ($area eq 'users') {
384: $r->print(" <td align='left'><font face='arial,helvetica,sans-serif'>
385: <select name='user_handling'>
386: <option value='-2'><-- Check Import first
387: </select>
388: </font>
389: </td>");
390: } else {
391: $r->print(" <td align='left'><font face='arial,helvetica,sans-serif'> None<input type='hidden' name='$count_tag' /></font></td>");
392: }
393: $counter ++;
394: $iter = $counter%2;
395: }
396: }
397: $r->print(<<ENDDOCUMENT);
398: </tr>
399: </table>
400: </td>
401: </tr>
402: </table>
403: </td>
404: </tr>
405: </table>
406: </td>
407: </tr>
408: <tr>
409: <td colspan='2'> <br /><br /></td>
410: </tr>
1.2 raeburn 411: <tr bgcolor='#CCCCFF'>
412: <td valign='middle'><img src='/res/adm/pages/bl_step4.gif'>
413: </td>
414: <td width='100%' align='left'>
415: <font face='arial,helvetica,sans-serif'><b>Choose display options for listing of contents of top level of package.</b></font>
416: </td>
417: </tr>
418: <tr>
419: <td colspan='2'> </td>
420: </tr>
1.1 raeburn 421: <tr>
422: <td> </td>
1.2 raeburn 423: <td>
424: <table border='0'>
425: <tr>
426: <td><font face='arial,helvetica,sans-serif'><input type="radio" name="toplevel" value="newfolder" />Display listing of contents in a new folder, with folder name: <input type="text" name="foldername" size="15" value="Type Name Here" /></font></td>
427: </tr>
428: <tr>
429: <td><font face='arial,helvetica,sans-serif'><input type="radio" name="toplevel" value="oldfolder" />Append listing of contents of top level of package to contents list for the current folder.</font></td>
430: </tr>
431: </table>
432: </td>
433: </tr>
434: <tr>
435: <td colspan='2'> </td>
436: </tr>
437: <tr>
438: <td> </td>
439: <td><font face='arial,helvetica,sans-serif'>Once you have checked the checkboxes for all areas you wish to import from the IMS package, selected options (if available), and selected a display option for the package contents you should click the 'Complete Import' button.</font></td>
1.1 raeburn 440: </tr>
441: <tr>
442: <td colspan='2'>
443: <input type="hidden" name="folder" value="$ENV{'form.folder'}" />
444: <input type="hidden" name="source" value="$cms" />
445: <input type="hidden" name="tempdir" value="$tempdir" />
446: <input type="hidden" name="phase" value="three" />
447: </td>
448: </tr>
449: <tr>
450: <td colspan='2'>
451: <table border='0' cellspacing='0' cellpadding='0' width="100%">
452: <tr>
453: <td align='left'>
454: <input type='button' name='exitpage' value='Exit now' onClick="javascript:self.close()">
455: </td>
456: <td align='right'>
457: <input type="button" name="nextpage" value="Complete Import" onClick="javascript:nextPage($counter)">
458: </td>
459: </tr>
460: </table>
461: </td>
462: </tr>
463: </table>
464: </td>
465: </tr>
466: </table>
467: ENDDOCUMENT
468: } else {
469: $r->print("Unpacking of your IMS package failed because an IMS manifest file was not located in the package\n");
470: }
471: } else {
472: $r->print("Processing of your IMS package failed because the file you uploaded could not be unzipped\n");
473: }
474: }
475:
476:
477: sub display_three {
1.2 raeburn 478: my ($r,$crs,$cdom,$chome,$uname,$udom,$areas,%cmsmap) = @_;
479: my $folder = $ENV{'form.folder'};
480: my $cms = $ENV{'form.source'};
481: my $tempdir = $ENV{'form.tempdir'};
482: my $longcrs = '';
483: if ($crs =~ m/^(\d)(\d)(\d)/) {
484: $longcrs = $1.'/'.$2.'/'.$3.'/'.$crs;
485: }
486: my %imports = ();
487: my @targets = ();
488: my %resources = ();
489: my %items = ();
490: my %hrefs = ();
491: my %urls = ();
492: my %resinfo = ();
493: my %total = (
494: page => 0,
495: prob => 0,
496: seq => 0,
497: board => 0,
498: quiz => 0,
499: surv => 0,
500: );
501: my @pages = ();
502: my @sequences = ();
503: my @resrcfiles = ();
504:
505: my $timenow = time;
506:
507: my $destdir = $Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$cdom.'/'.$crs.'/'.$timenow;
508: my $dirname = $cdom.'/'.$crs.'/'.$timenow;
509: my $seqstem = "/uploaded/$cdom/$crs/$timenow";
510: my $db_handling = '';
511: my $user_handling = '';
512:
513: my $toplevel = '';
514: my $foldername = '';
515: my %topitems = ();
516: if (defined($ENV{'form.toplevel'}) ) {
517: $toplevel = $ENV{'form.toplevel'};
518: }
519: if (defined($ENV{'form.foldername'}) ) {
520: $foldername = $ENV{'form.foldername'};
521: }
522:
523: foreach my $area (@{$areas}) {
524: if (defined($ENV{"form.$area"}) ) {
525: if ($cms eq 'angel' && $area eq 'doc') {
526: foreach (@{$cmsmap{$cms}{$area}}) {
527: $imports{$_} = 1;
528: }
529: } else {
530: $imports{$cmsmap{$cms}{$area}} = 1;
531: }
532: if ($area eq 'board') {
533: $db_handling = $ENV{'form.db_handling'};
534: } elsif ($area eq 'users') {
535: $user_handling = $ENV{'form.user_handling'};
536: }
537: }
538: }
1.1 raeburn 539:
1.2 raeburn 540: my $manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo);
541: if ($manifest_result eq 'ok') {
1.5 ! raeburn 542: my @path = ($cdom,$crs,$timenow);
! 543: my $fullpath = $Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles';
! 544: foreach my $item (@path) {
! 545: $fullpath .= '/'.$item;
! 546: if (!-e "$fullpath") {
! 547: mkdir("$fullpath",0770);
! 548: }
! 549: }
! 550: my @namedirs = ("resfiles","sequences","pages","problems");
! 551: foreach my $name (@namedirs) {
! 552: if (!-e "$fullpath/$name") {
! 553: mkdir("$fullpath/$name",0770);
! 554: }
! 555: }
1.2 raeburn 556: &Apache::imsprocessor::target_resources(\%resources,\%imports,\@targets);
557: my $copy_result = &Apache::imsprocessor::copy_resources('DOCS',$cms,\%hrefs,$tempdir,\@targets,\%urls,$crs,$cdom,$chome,$destdir,$timenow);
558:
559: my @boards = ();
560: my @announcements = ();
561: my @quizzes = ();
562: my @surveys = ();
563: my @groups = ();
564: my %messages = ();
565: my @timestamp = ();
566: my %boardnum = ();
567: my @topurls = ();
568: my @topnames = ();
569:
570: &Apache::imsprocessor::process_resinfo($cms,$tempdir,$destdir,\%items,\%resources,\@boards,\@announcements,\@quizzes,\@surveys,\@groups,\%messages,\@timestamp,\%boardnum,\%resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,\%total,$dirname,$seqstem,\@resrcfiles);
571:
1.3 raeburn 572: &Apache::imsprocessor::build_structure($cms,'DOCS',$destdir,\%items,\%resinfo,\%resources,\%hrefs,$udom,$uname,'',$timenow,$cdom,$crs,\@timestamp,\%total,\@boards,\@announcements,\@quizzes,\@surveys,\%boardnum,\@pages,\@sequences,\@topurls,\@topnames);
1.2 raeburn 573:
574: foreach my $item (@pages) {
1.3 raeburn 575: my $filename = $timenow.'/pages/'.$item;
576: my $fetchresult= &Apache::lonnet::process_coursefile('propagate',$crs,$cdom,$chome,$filename,'');
1.2 raeburn 577: }
578: foreach my $item (@sequences) {
579: unless ($item eq 'Top.sequence' && $toplevel eq 'oldfolder') {
1.3 raeburn 580: my $filename = $timenow.'/sequences/'.$item;
581: my $fetchresult= &Apache::lonnet::process_coursefile('propagate',$crs,$cdom,$chome,$filename,'');
1.2 raeburn 582: }
583: }
584: foreach my $item (@resrcfiles) {
1.3 raeburn 585: my $filename = $timenow.'/resfiles/'.$item;
586: my $fetchresult= &Apache::lonnet::process_coursefile('propagate',$crs,$cdom,$chome,$filename,'');
1.2 raeburn 587: }
588:
589: my @imports = ();
590: if ($toplevel eq 'oldfolder') {
591: for (my $i=0; $i<@topurls; $i++) {
592: my $url = &Apache::lonnet::unescape($topurls[$i]);
593: my $name = &Apache::lonnet::unescape($topnames[$i]);
594: push @imports, $name, $url;
595: }
596: } elsif ($toplevel eq 'newfolder') {
597: my $url = &Apache::lonnet::unescape("/uploaded/$cdom/$crs/$timenow/sequences/Top.sequence");
598: my $name = &Apache::lonnet::unescape("$ENV{'form.foldername'}");
599: push @imports, $name, $url;
600: }
601: my $errtext='';
602: my $fatal=0;
603: ($errtext,$fatal)= &Apache::londocs::mapread($crs,$cdom,$folder.'.sequence');
604: if ($#Apache::lonratedt::order<1) {
605: $Apache::lonratedt::order[0]=1;
606: $Apache::lonratedt::resources[1]='';
607: }
608: my ($errtext,$fatal)=&Apache::londocs::group_import($crs, $cdom, $folder,@imports);
609: if ($fatal) {
610: print STDERR "Fatal error during group_import\n";
611: }
612: }
1.3 raeburn 613: if ($tempdir =~ m/^\/home\/httpd\/perl\/tmp\/$crs\/\d{10}/) {
614: system("rm -r -f $tempdir");
615: }
1.2 raeburn 616: $r->print(<<ENDBLOCK);
617: <table border='0' bgcolor='#F6F6F6'' cellspacing='0' cellpadding ='0' width='100%'>
618: <tr>
619: <td colspan='2'>
620: <table border='0' cellspacing='0' cellpadding='0'>
621: <tr>
622: <td colspan='2' align='left'>
623: </td>
624: </tr>
625: <tr bgcolor='#CCCCFF'>
626: <td valign='middle'><img src='/res/adm/pages/bl_step5.gif'>
627: </td>
628: <td width='100%' align='left'>
629: <font face='arial,helvetica,sans-serif'><b>Your import is complete</b></font>
630: </td>
631: </tr>
632: <tr>
633: <td colspan='2'> </td>
634: </tr>
635: <tr>
636: <td> </td>
637: <td>
638: ENDBLOCK
639: my $initblock = qq|
640: <form method="post" action="/adm/roles" target="loncapaclient" name="importDone">
641: <input type="hidden" name="orgurl" value="/adm/coursedocs" />
642: <input type="hidden" name="selectrole" value="1" />
643: <h3><font color="red">Changes will become active for your current session after
644: <input type="hidden" name="$ENV{'request.role'}" value="1" />
645: <input type="button" value="|;
646: $initblock .= &mt('re-initializing course');
647: $initblock .= qq|" onClick="javascript:init(this.form)"/>|;
648: $initblock .= &mt('or the next time you log in.');
649: $initblock .= qq|</font></h3></form>|;
650: $r->print($initblock);
651: $r->print(<<ENDBLOCKTWO);
652: </table>
653: </td>
654: </tr>
655: </table>
656: ENDBLOCKTWO
1.1 raeburn 657: }
658:
659: 1;
660: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>