version 1.14, 2005/10/27 18:19:36
|
version 1.22, 2009/05/04 16:45:51
|
Line 1
|
Line 1
|
|
# The LearningOnline Network with CAPA |
|
# |
|
# $Id$ |
|
# |
# Copyright Michigan State University Board of Trustees |
# Copyright Michigan State University Board of Trustees |
# |
# |
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
Line 30 use Apache::loncommon;
|
Line 34 use Apache::loncommon;
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::imsprocessor; |
use Apache::imsprocessor; |
use LONCAPA::Configuration; |
use LONCAPA::Configuration; |
|
use LONCAPA::map(); |
|
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
|
use strict; |
use strict; |
|
|
sub jscript_one { |
sub jscript_one { |
Line 150 sub handler {
|
Line 158 sub handler {
|
|
|
my $uname=$env{'user.name'}; |
my $uname=$env{'user.name'}; |
my $udom=$env{'user.domain'}; |
my $udom=$env{'user.domain'}; |
my $plainname=&Apache::lonnet::escape( |
my $plainname=&escape( |
&Apache::loncommon::plainname($uname,$udom)); |
&Apache::loncommon::plainname($uname,$udom)); |
|
|
# does this user have privileges to post, etc? |
# does this user have privileges to post, etc? |
my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'}); |
my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'}); |
unless ($allowed) { |
unless ($allowed) { |
$r->print("<html><head><title>The LearningOnline Network with CAPA</title></head>"); |
$r->print(&Apache::loncommon::start_page('Import IMS package',undef, |
$r->print(&Apache::loncommon::bodytag('Import IMS package',undef,'',1)); |
{'only_body' => 1,})); |
$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>'); |
$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.'). |
|
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|
Line 173 sub handler {
|
Line 182 sub handler {
|
&jscript_three(\$javascript); |
&jscript_three(\$javascript); |
} |
} |
|
|
|
$javascript = |
|
"<script type=\"text/javascript\">\n". |
|
"//<!--\n$javascript\n// --></script>\n"; |
|
my $start_page = &Apache::loncommon::start_page('Import IMS package', |
|
$javascript, |
|
{'only_body' => 1,}); |
# print screen |
# print screen |
$r->print(<<ENDHEAD); |
$r->print($start_page); |
<html> |
|
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
<script type="text/javascript"> |
|
<!-- |
|
$javascript |
|
--> |
|
</script> |
|
</head> |
|
ENDHEAD |
|
# -------------------------------------------------------------------- Body tag |
|
$r->print(&Apache::loncommon::bodytag('Import IMS package',undef,'',1)); |
|
if ($env{'form.phase'} eq 'one') { |
if ($env{'form.phase'} eq 'one') { |
&display_one($r); |
&display_one($r); |
} elsif ($env{'form.phase'} eq 'two') { |
} elsif ($env{'form.phase'} eq 'two') { |
Line 194 ENDHEAD
|
Line 198 ENDHEAD
|
} elsif ($env{'form.phase'} eq 'three') { |
} elsif ($env{'form.phase'} eq 'three') { |
&display_three($r,$coursenum,$coursedom,$uname,$udom,\@areas,%cmsmap); |
&display_three($r,$coursenum,$coursedom,$uname,$udom,\@areas,%cmsmap); |
} |
} |
$r->print("</body><html>"); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|
Line 214 sub display_one {
|
Line 218 sub display_one {
|
</td> |
</td> |
</tr> |
</tr> |
<tr bgcolor='#CCCCFF'> |
<tr bgcolor='#CCCCFF'> |
<td valign='middle'><img src='/res/adm/pages/bl_step1.gif'> |
<td valign="middle"><img src="/res/adm/pages/bl_step1.gif" alt="1" /> |
</td> |
</td> |
<td width='100%' align='left'> |
<td width='100%' align='left'> |
<font face='arial,helvetica,sans-serif'><b>Specify the Course Management system used to create the package.</b> |
<font face='arial,helvetica,sans-serif'><b>Specify the Course Management system used to create the package.</b> |
Line 230 sub display_one {
|
Line 234 sub display_one {
|
<font face='Arial,Helvetica,sans-serif'> |
<font face='Arial,Helvetica,sans-serif'> |
Please choose the CMS used to create your IMS content package. |
Please choose the CMS used to create your IMS content package. |
<select name="source"> |
<select name="source"> |
<option value='-1' selected="true">Please select |
<option value='-1' selected="true">Please select</option> |
<option value='bb5'>Blackboard 5 |
<option value='bb5'>Blackboard 5</option> |
<option value='bb6'>Blackboard 6 |
<option value='bb6'>Blackboard 6</option> |
<option value='angel'>ANGEL |
<option value='angel'>ANGEL</option> |
<option value='webct4'>WebCT 4 |
<option value='webctce4'>WebCT 4 Campus Edition</option> |
</select> |
</select> |
</font> |
</font> |
</td> |
</td> |
Line 246 Please choose the CMS used to create you
|
Line 250 Please choose the CMS used to create you
|
<td colspan='2'> </td> |
<td colspan='2'> </td> |
</tr> |
</tr> |
<tr bgcolor='#CCCCFF'> |
<tr bgcolor='#CCCCFF'> |
<td valign='middle'><img src='/res/adm/pages/bl_step2.gif'> |
<td valign="middle"><img src="/res/adm/pages/bl_step2.gif" alt="2" /> |
</td> |
</td> |
<td width='100%' align='left'> |
<td width='100%' align='left'> |
<font face='arial,helvetica,sans-serif'><b>Locate the IMS content package you wish to upload.</b> |
<font face='arial,helvetica,sans-serif'><b>Locate the IMS content package you wish to upload.</b> |
Line 278 Please choose the CMS used to create you
|
Line 282 Please choose the CMS used to create you
|
<table border='0' cellspacing='0' cellpadding='0' width="100%"> |
<table border='0' cellspacing='0' cellpadding='0' width="100%"> |
<tr> |
<tr> |
<td align='left'> |
<td align='left'> |
<input type="button" name="exitpage" value="Exit now" onClick="javascript:self.close()"> |
<input type="button" name="exitpage" value="Exit now" onClick="javascript:self.close()" /> |
</td> |
</td> |
<td align='right'> |
<td align='right'> |
<input type="button" name="nextpage" value="Upload IMS package" onClick="javascript:nextPage()"> |
<input type="button" name="nextpage" value="Upload IMS package" onClick="javascript:nextPage()" /> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 336 sub display_two {
|
Line 340 sub display_two {
|
$manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo,'choose',\%includedres,\%includeditems); |
$manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo,'choose',\%includedres,\%includeditems); |
if ($manifest_result eq 'ok') { |
if ($manifest_result eq 'ok') { |
foreach my $res (sort keys %resources) { |
foreach my $res (sort keys %resources) { |
if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webct4') { |
if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webctce4') { |
foreach my $area (keys %{$cmsmap{$cms}}) { |
foreach my $area (keys %{$cmsmap{$cms}}) { |
if ($resources{$res}{type} eq $cmsmap{$cms}{$area}) { |
if ($resources{$res}{type} eq $cmsmap{$cms}{$area}) { |
$count{$area} ++; |
$count{$area} ++; |
Line 365 sub display_two {
|
Line 369 sub display_two {
|
</td> |
</td> |
</tr> |
</tr> |
<tr bgcolor='#CCCCFF'> |
<tr bgcolor='#CCCCFF'> |
<td valign='middle'><img src='/res/adm/pages/bl_step3.gif'> |
<td valign="middle"><img src="/res/adm/pages/bl_step3.gif" alt="3" /> |
</td> |
</td> |
<td width='100%' align='left'> |
<td width='100%' align='left'> |
<font face='arial,helvetica,sans-serif'><b>Choose which content types you wish to import</b></font> |
<font face='arial,helvetica,sans-serif'><b>Choose which content types you wish to import</b></font> |
Line 403 ENDBLOCK
|
Line 407 ENDBLOCK
|
if ($area eq 'board') { |
if ($area eq 'board') { |
$r->print(" <td align='left'><font face='arial,helvetica,sans-serif'> |
$r->print(" <td align='left'><font face='arial,helvetica,sans-serif'> |
<select name='db_handling'> |
<select name='db_handling'> |
<option value='-2'><-- Check Import first |
<option value='-2'><-- Check Import first</option> |
</select></font> |
</select></font> |
</td>"); |
</td>"); |
} elsif ($area eq 'users') { |
} elsif ($area eq 'users') { |
$r->print(" <td align='left'><font face='arial,helvetica,sans-serif'> |
$r->print(" <td align='left'><font face='arial,helvetica,sans-serif'> |
<select name='user_handling'> |
<select name='user_handling'> |
<option value='-2'><-- Check Import first |
<option value='-2'><-- Check Import first</option> |
</select> |
</select> |
</font> |
</font> |
</td>"); |
</td>"); |
Line 435 ENDBLOCK
|
Line 439 ENDBLOCK
|
<td colspan='2'> <br /><br /></td> |
<td colspan='2'> <br /><br /></td> |
</tr> |
</tr> |
<tr bgcolor='#CCCCFF'> |
<tr bgcolor='#CCCCFF'> |
<td valign='middle'><img src='/res/adm/pages/bl_step4.gif'> |
<td valign="middle"><img src="/res/adm/pages/bl_step4.gif" alt="4" /> |
</td> |
</td> |
<td width='100%' align='left'> |
<td width='100%' align='left'> |
<font face='arial,helvetica,sans-serif'><b>Choose display options for listing of contents of top level of package.</b></font> |
<font face='arial,helvetica,sans-serif'><b>Choose display options for listing of contents of top level of package.</b></font> |
Line 449 ENDBLOCK
|
Line 453 ENDBLOCK
|
<td> |
<td> |
<table border='0'> |
<table border='0'> |
<tr> |
<tr> |
<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> |
<td><font face='arial,helvetica,sans-serif'><label><input type="radio" name="toplevel" value="newfolder" />Display listing of contents in a new folder, with folder name:</label> <input type="text" name="foldername" size="15" value="Type Name Here" /></font></td> |
</tr> |
</tr> |
<tr> |
<tr> |
<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> |
<td><font face='arial,helvetica,sans-serif'><label><input type="radio" name="toplevel" value="oldfolder" />Append listing of contents of top level of package to contents list for the current folder.</label></font></td> |
</tr> |
</tr> |
</table> |
</table> |
</td> |
</td> |
Line 477 ENDBLOCK
|
Line 481 ENDBLOCK
|
<table border='0' cellspacing='0' cellpadding='0' width="100%"> |
<table border='0' cellspacing='0' cellpadding='0' width="100%"> |
<tr> |
<tr> |
<td align='left'> |
<td align='left'> |
<input type='button' name='exitpage' value='Exit now' onClick="javascript:self.close()"> |
<input type='button' name='exitpage' value='Exit now' onClick="javascript:self.close()" /> |
</td> |
</td> |
<td align='right'> |
<td align='right'> |
<input type="button" name="nextpage" value="Complete Import" onClick="javascript:nextPage($counter)"> |
<input type="button" name="nextpage" value="Complete Import" onClick="javascript:nextPage($counter)" /> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 635 sub display_three {
|
Line 639 sub display_three {
|
my @imports = (); |
my @imports = (); |
if ($toplevel eq 'oldfolder') { |
if ($toplevel eq 'oldfolder') { |
for (my $i=0; $i<@topurls; $i++) { |
for (my $i=0; $i<@topurls; $i++) { |
my $url = &Apache::lonnet::unescape($topurls[$i]); |
my $url = &unescape($topurls[$i]); |
my $name = &Apache::lonnet::unescape($topnames[$i]); |
my $name = &unescape($topnames[$i]); |
push @imports, $name, $url; |
push(@imports, [$name, $url]); |
} |
} |
} elsif ($toplevel eq 'newfolder') { |
} elsif ($toplevel eq 'newfolder') { |
my $url = &Apache::lonnet::unescape("/uploaded/$cdom/$crs/$timenow/sequences/Top.sequence"); |
my $url = &unescape("/uploaded/$cdom/$crs/$timenow/sequences/Top.sequence"); |
my $name = &Apache::lonnet::unescape("$env{'form.foldername'}"); |
my $name = &unescape("$env{'form.foldername'}"); |
push @imports, $name, $url; |
push(@imports, [$name, $url]); |
} |
} |
my $errtext=''; |
my $errtext=''; |
my $fatal=0; |
my $fatal=0; |
($errtext,$fatal)= &Apache::londocs::mapread($crs,$cdom,$folder.'.sequence'); |
($errtext,$fatal)= &Apache::londocs::mapread($crs,$cdom,$folder.'.sequence'); |
if ($#Apache::lonratedt::order<1) { |
if ($#LONCAPA::map::order<1) { |
$Apache::lonratedt::order[0]=1; |
$LONCAPA::map::order[0]=1; |
$Apache::lonratedt::resources[1]=''; |
$LONCAPA::map::resources[1]=''; |
} |
} |
my ($errtext,$fatal)=&Apache::londocs::group_import($crs,$cdom,$folder,'sequence','imsimport',@imports); |
my ($errtext,$fatal)=&Apache::londocs::group_import($crs,$cdom,$folder,'sequence','imsimport',@imports); |
if ($fatal) { |
if ($fatal) { |
print STDERR "Fatal error during group_import\n"; |
&Apache::lonnet::logthis("Fatal error during group_import."); |
} |
} |
} |
} |
if ($tempdir =~ m/^\/home\/httpd\/perl\/tmp\/$crs\/\d{10}/) { |
if ($tempdir =~ m/^\/home\/httpd\/perl\/tmp\/$crs\/\d{10}/) { |
Line 669 sub display_three {
|
Line 673 sub display_three {
|
</td> |
</td> |
</tr> |
</tr> |
<tr bgcolor='#CCCCFF'> |
<tr bgcolor='#CCCCFF'> |
<td valign='middle'><img src='/res/adm/pages/bl_step5.gif'> |
<td valign="middle"><img src="/res/adm/pages/bl_step5.gif" alt="5" /> |
</td> |
</td> |
<td width='100%' align='left'> |
<td width='100%' align='left'> |
<font face='arial,helvetica,sans-serif'><b>Your import is complete</b></font> |
<font face='arial,helvetica,sans-serif'><b>Your import is complete</b></font> |
Line 690 ENDBLOCK
|
Line 694 ENDBLOCK
|
<input type="hidden" name="$env{'request.role'}" value="1" /> |
<input type="hidden" name="$env{'request.role'}" value="1" /> |
<input type="button" value="|; |
<input type="button" value="|; |
$initblock .= &mt('re-initializing course'); |
$initblock .= &mt('re-initializing course'); |
$initblock .= qq|" onClick="javascript:init(this.form)"/>|; |
$initblock .= qq|" onClick="javascript:init(this.form)" />|; |
$initblock .= ', '.&mt('or the next time you log in.'); |
$initblock .= ', '.&mt('or the next time you log in.'); |
$initblock .= qq|</font></h3></form>|; |
$initblock .= qq|</font></h3></form>|; |
$r->print($initblock); |
$r->print($initblock); |