version 1.23, 2009/08/17 03:52:09
|
version 1.25, 2009/11/20 11:16:59
|
Line 165 sub handler {
|
Line 165 sub handler {
|
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(&Apache::loncommon::start_page('Import IMS package',undef, |
$r->print(&Apache::loncommon::start_page('Import IMS package',undef, |
{'only_body' => 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.'). |
$r->print( |
&Apache::loncommon::end_page()); |
'<p class="LC_error">' |
|
.&mt('Modification of Course Contents Disallowed') |
|
.'</p><p>' |
|
.&mt('Your current role does not grant you the right to modify course content in this course.') |
|
.'</p>' |
|
.&Apache::loncommon::end_page() |
|
); |
return OK; |
return OK; |
} |
} |
|
|
Line 183 sub handler {
|
Line 189 sub handler {
|
} |
} |
|
|
$javascript = |
$javascript = |
"<script type=\"text/javascript\">\n". |
"<script type=\"text/javascript\">\n". |
"//<!--\n$javascript\n// --></script>\n"; |
"//<!--\n$javascript\n// --></script>\n"; |
my $start_page = &Apache::loncommon::start_page('Import IMS package', |
my $headline = 'Import IMS package'; |
$javascript, |
my $start_page = &Apache::loncommon::start_page($headline, |
{'only_body' => 1,}); |
$javascript, |
|
{'only_body' => 1,}) |
|
.'<h1>'.&mt($headline).'</h1>'; |
# print screen |
# print screen |
$r->print($start_page); |
$r->print($start_page); |
|
|
Line 207 sub display_one {
|
Line 215 sub display_one {
|
my ($r) = @_; |
my ($r) = @_; |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folder']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folder']); |
|
|
$r->print(<<ENDBLOCK); |
$r->print( |
<form action="/adm/imsimportdocs" method="post" enctype="multipart/form-data" name="pickcms"> |
'<form action="/adm/imsimportdocs" method="post"' |
<table border='0' bgcolor='#F6F6F6' cellspacing='0' cellpadding ='0' width='100%'> |
.' enctype="multipart/form-data" name="pickcms">' |
<tr> |
.&Apache::lonhtmlcommon::topic_bar( |
<td colspan='2'> |
1,&mt('Specify the Course Management system used to create the package')) |
<table border='0' cellspacing='0' cellpadding='0'> |
.&mt('Please choose the CMS used to create your IMS content package:').' ' |
<tr> |
.'<select name="source">' |
<td colspan='2' align='left'> |
.'<option value="-1" selected="selected">'.&mt('Please select').'</option>' |
</td> |
.'<option value="bb5">Blackboard 5</option>' |
</tr> |
.'<option value="bb6">Blackboard 6</option>' |
<tr bgcolor='#CCCCFF'> |
.'<option value="angel5">ANGEL 5.5</option>' |
<td valign="middle"><img src="/res/adm/pages/bl_step1.gif" alt="1" /> |
.'<option value="webctce4">WebCT 4 Campus Edition</option>' |
</td> |
.'</select>' |
<td width='100%' align='left'> |
); |
<font face='arial,helvetica,sans-serif'><b>Specify the Course Management system used to create the package.</b> |
$r->print( |
</font> |
&Apache::lonhtmlcommon::topic_bar( |
</td> |
2,&mt('Locate the IMS content package you wish to upload')) |
</tr> |
.'<input type="hidden" name="folder" value="'.$env{'form.folder'}.'" />' |
<tr> |
.'<input type="hidden" name="phase" value="two" />' |
<td colspan='2'> </td> |
.&mt('File:') |
</tr> |
.' <input type="file" name="uploadname" size="40" />' |
<tr> |
); |
<td> </td> |
$r->print( |
<td> |
'<hr />' |
<font face='Arial,Helvetica,sans-serif'> |
.'<p>' |
Please choose the CMS used to create your IMS content package. |
.'<input type="button" name="exitpage" value="'.&mt('Cancel').'"' |
<select name="source"> |
.' onclick="javascript:self.close()" />' |
<option value='-1' selected="true">Please select</option> |
.' ' |
<option value='bb5'>Blackboard 5</option> |
.'<input type="button" name="nextpage" value="'.&mt('Upload IMS package').'"' |
<option value='bb6'>Blackboard 6</option> |
.' onclick="javascript:nextPage()" />' |
<option value='angel5'>ANGEL 5.5</option> |
.'</p>' |
<option value='webctce4'>WebCT 4 Campus Edition</option> |
); |
</select> |
|
</font> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td colspan='2'> </td> |
|
</tr> |
|
<tr> |
|
<td colspan='2'> </td> |
|
</tr> |
|
<tr bgcolor='#CCCCFF'> |
|
<td valign="middle"><img src="/res/adm/pages/bl_step2.gif" alt="2" /> |
|
</td> |
|
<td width='100%' align='left'> |
|
<font face='arial,helvetica,sans-serif'><b>Locate the IMS content package you wish to upload.</b> |
|
</font> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td colspan='2'> </td> |
|
</tr> |
|
<tr> |
|
<td colspan='2'> |
|
<input type="hidden" name="folder" value="$env{'form.folder'}" /> |
|
<input type="hidden" name="phase" value="two" /> |
|
<input type="file" name="uploadname" size="40" /> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td colspan='2'> </td> |
|
</tr> |
|
<tr> |
|
<td> </td> |
|
<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> |
|
</tr> |
|
<tr> |
|
<td colspan='2'> </td> |
|
</tr> |
|
<tr |
|
<td colspan='2'> |
|
<table border='0' cellspacing='0' cellpadding='0' width="100%"> |
|
<tr> |
|
<td align='left'> |
|
<input type="button" name="exitpage" value="Exit now" onClick="javascript:self.close()" /> |
|
</td> |
|
<td align='right'> |
|
<input type="button" name="nextpage" value="Upload IMS package" onClick="javascript:nextPage()" /> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</form> |
|
ENDBLOCK |
|
} |
} |
|
|
|
|
Line 336 sub display_two {
|
Line 286 sub display_two {
|
users => 0, |
users => 0, |
); |
); |
|
|
if ($unzip_result eq 'ok') { |
if ($unzip_result ne 'ok') { |
$manifest_result = &Apache::imsprocessor::process_manifest($cms,$tempdir,\%resources,\%items,\%hrefs,\%resinfo,'choose',\%includedres,\%includeditems); |
$r->print( |
if ($manifest_result eq 'ok') { |
'<p class="LC_warning">' |
foreach my $res (sort keys %resources) { |
.&mt('Processing of your IMS package failed because the file you' |
if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webctce4') { |
.' uploaded could not be unzipped.') |
foreach my $area (keys %{$cmsmap{$cms}}) { |
.'</p>' |
if ($resources{$res}{type} eq $cmsmap{$cms}{$area}) { |
); |
$count{$area} ++; |
return(); |
} |
} |
} |
|
} elsif ($cms eq 'angel5') { |
# Get manifest file from package |
foreach my $area (keys %{$cmsmap{$cms}}) { |
$manifest_result = &Apache::imsprocessor::process_manifest( |
if ($area eq 'doc') { |
$cms,$tempdir,\%resources,\%items,\%hrefs, |
if (grep/^$resources{$res}{type}$/,@{$cmsmap{$cms}{doc}}) { |
\%resinfo,'choose',\%includedres,\%includeditems); |
$count{$area} ++; |
if ($manifest_result ne 'ok') { |
} |
$r->print( |
} elsif ($resources{$res}{type} eq $cmsmap{$cms}{$area}) { |
'<p class="LC_warning">' |
$count{$area} ++; |
.&mt('Unpacking of your IMS package failed because an IMS manifest file was not located in the package.') |
} |
.'</p>' |
|
); |
|
return(); |
|
} |
|
|
|
# Count areas depending on cms version |
|
foreach my $res (sort keys %resources) { |
|
if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webctce4') { |
|
foreach my $area (keys %{$cmsmap{$cms}}) { |
|
if ($resources{$res}{type} eq $cmsmap{$cms}{$area}) { |
|
$count{$area} ++; |
|
} |
|
} |
|
} elsif ($cms eq 'angel5') { |
|
foreach my $area (keys %{$cmsmap{$cms}}) { |
|
if ($area eq 'doc') { |
|
if (grep/^$resources{$res}{type}$/,@{$cmsmap{$cms}{doc}}) { |
|
$count{$area} ++; |
} |
} |
|
} elsif ($resources{$res}{type} eq $cmsmap{$cms}{$area}) { |
|
$count{$area} ++; |
} |
} |
} |
} |
|
} else { # Unknown cms format |
|
$r->print( |
|
'<span class="LC_warning">' |
|
.&mt('Unsupported IMS format: [_1]',$cms) |
|
.'</span><br />' |
|
); |
|
# return(); |
|
} |
|
} |
|
|
$r->print(<<ENDBLOCK); |
$r->print(<<ENDBLOCK); |
<form name="pickoptions" method="post"> |
<form name="pickoptions" method="post"> |
<table border='0' bgcolor='#F6F6F6'' cellspacing='0' cellpadding ='0' width='100%'> |
<table border='0' bgcolor='#F6F6F6'' cellspacing='0' cellpadding ='0' width='100%'> |
Line 442 ENDBLOCK
|
Line 421 ENDBLOCK
|
<td valign="middle"><img src="/res/adm/pages/bl_step4.gif" alt="4" /> |
<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> |
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
Line 481 ENDBLOCK
|
Line 460 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='Cancel' 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)" /> |
Line 495 ENDBLOCK
|
Line 474 ENDBLOCK
|
</tr> |
</tr> |
</table> |
</table> |
ENDDOCUMENT |
ENDDOCUMENT |
} else { |
|
$r->print("Unpacking of your IMS package failed because an IMS manifest file was not located in the package\n"); |
|
} |
|
} else { |
|
$r->print("Processing of your IMS package failed because the file you uploaded could not be unzipped\n"); |
|
} |
|
} |
} |
|
|
|
|