version 1.9, 2005/02/14 22:46:12
|
version 1.12, 2005/10/27 18:19:36
|
Line 293 sub display_one {
|
Line 293 sub display_one {
|
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 value='bb6'>Blackboard 6 |
|
<option value='bb5'>Blackboard 5 |
<option value='bb5'>Blackboard 5 |
|
<option value='bb6'>Blackboard 6 |
<option value='angel'>ANGEL |
<option value='angel'>ANGEL |
|
<option value='webct4'>WebCT 4 |
</select> |
</select> |
</font> |
</font> |
</td> |
</td> |
Line 364 END_OF_ONE
|
Line 365 END_OF_ONE
|
sub display_two { |
sub display_two { |
my ($r,$zipupload,$areas,$areaname,$cmsmap,$uname,$newdir,$numcrs,$fullpath) = @_; |
my ($r,$zipupload,$areas,$areaname,$cmsmap,$uname,$newdir,$numcrs,$fullpath) = @_; |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folder','source']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folder','source']); |
my $cms = $ENV{'form.source'}; |
my $cms = $env{'form.source'}; |
my $dirname = $ENV{'form.newdir'}; |
my $dirname = $env{'form.newdir'}; |
my $tempdir = &Apache::imsprocessor::create_tempdir('CSTR',$dirname,''); |
my $tempdir = &Apache::imsprocessor::create_tempdir('CSTR',$dirname,''); |
my $fname = &Apache::imsprocessor::uploadzip('CSTR',$tempdir,$zipupload); |
my $fname = &Apache::imsprocessor::uploadzip('CSTR',$tempdir,$zipupload); |
my $unzip_result = ''; |
my $unzip_result = ''; |
Line 402 sub display_two {
|
Line 403 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') { |
if ($cms eq 'bb5' || $cms eq 'bb6' || $cms eq 'webct4') { |
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 556 Choose course:
|
Line 557 Choose course:
|
</tr> |
</tr> |
<tr> |
<tr> |
<td colspan='2'> |
<td colspan='2'> |
<input type="hidden" name="newdir" value="$ENV{'form.newdir'}" /> |
<input type="hidden" name="newdir" value="$env{'form.newdir'}" /> |
<input type="hidden" name="conditions" value="$conditions" /> |
<input type="hidden" name="conditions" value="$conditions" /> |
<input type="hidden" name="source" value="$cms" /> |
<input type="hidden" name="source" value="$cms" /> |
<input type="hidden" name="tempdir" value="$tempdir" /> |
<input type="hidden" name="tempdir" value="$tempdir" /> |
Line 605 sub display_three {
|
Line 606 sub display_three {
|
my ($r,$uname,$udom,$areas,$areaname,$cmsmap,$destdir,$newdir) = @_; |
my ($r,$uname,$udom,$areas,$areaname,$cmsmap,$destdir,$newdir) = @_; |
my $crs = ''; |
my $crs = ''; |
my $cdom = ''; |
my $cdom = ''; |
my $chome = ''; |
|
my $db_handling = ''; |
my $db_handling = ''; |
my $timenow = time; |
my $timenow = time; |
my $announce_handling = 'ok'; |
my $announce_handling = 'ok'; |
my $cms = $ENV{'form.source'}; |
my $cms = $env{'form.source'}; |
if ( defined($ENV{'form.bb_crs'}) ) { |
if ( defined($env{'form.bb_crs'}) ) { |
($cdom,$crs) = split/\//,$ENV{'form.bb_crs'}; |
($cdom,$crs) = split/\//,$env{'form.bb_crs'}; |
$chome = &Apache::lonnet::homeserver($crs,$cdom); |
|
} |
} |
my $user_crs = ''; |
my $user_crs = ''; |
my $user_cdom = ''; |
my $user_cdom = ''; |
my $user_handling = ''; |
my $user_handling = ''; |
if ( defined($ENV{'form.user_crs'}) ) { |
if ( defined($env{'form.user_crs'}) ) { |
($user_cdom,$user_crs) = split/\//,$ENV{'form.user_crs'}; |
($user_cdom,$user_crs) = split/\//,$env{'form.user_crs'}; |
} |
} |
my $seqstem = "/res/$udom/$uname/$newdir"; |
my $seqstem = "/res/$udom/$uname/$newdir"; |
my %importareas = (); |
my %importareas = (); |
my %includedres = (); |
my %includedres = (); |
my %includeditems = (); |
my %includeditems = (); |
|
my %randompicks = (); |
my @targets = (); |
my @targets = (); |
my %resources = (); |
my %resources = (); |
my %items = (); |
my %items = (); |
Line 643 sub display_three {
|
Line 643 sub display_three {
|
my @sequences = (); |
my @sequences = (); |
my @resrcfiles = (); |
my @resrcfiles = (); |
|
|
my $tempdir = $ENV{'form.tempdir'}; |
my $tempdir = $env{'form.tempdir'}; |
|
|
foreach my $area (@{$areas}) { |
foreach my $area (@{$areas}) { |
if (defined($ENV{"form.$area"}) ) { |
if (defined($env{"form.$area"}) ) { |
if ($cms eq 'angel' && $area eq 'doc') { |
if ($cms eq 'angel' && $area eq 'doc') { |
foreach (@{$$cmsmap{$cms}{$area}}) { |
foreach (@{$$cmsmap{$cms}{$area}}) { |
$importareas{$_} = 1; |
$importareas{$_} = 1; |
Line 655 sub display_three {
|
Line 655 sub display_three {
|
$importareas{$$cmsmap{$cms}{$area}} = 1; |
$importareas{$$cmsmap{$cms}{$area}} = 1; |
} |
} |
if ($area eq 'board') { |
if ($area eq 'board') { |
$db_handling = $ENV{'form.db_handling'}; |
$db_handling = $env{'form.db_handling'}; |
} elsif ($area eq 'users') { |
} elsif ($area eq 'users') { |
$user_handling = $ENV{'form.user_handling'}; |
$user_handling = $env{'form.user_handling'}; |
} |
} |
} |
} |
} |
} |
Line 695 sub display_three {
|
Line 695 sub display_three {
|
my @topnames = (); |
my @topnames = (); |
my @packages = (); |
my @packages = (); |
|
|
&Apache::imsprocessor::process_resinfo($cms,'CSTR',$tempdir,$destdir,\%items,\%resources,\@targets,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\@groups,\%messages,\@timestamp,\%boardnum,\%resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,\%total,$seqstem,$seqstem,\@resrcfiles,\@packages,\%hrefs,\@pages,\@sequences); |
&Apache::imsprocessor::process_resinfo($cms,'CSTR',$tempdir,$destdir,\%items,\%resources,\@targets,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\@groups,\%messages,\@timestamp,\%boardnum,\%resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,\%total,$seqstem,$seqstem,\@resrcfiles,\@packages,\%hrefs,\@pages,\@sequences,\%randompicks); |
|
|
my $copy_result = &Apache::imsprocessor::copy_resources('CSTR',$cms,\%hrefs,$tempdir,\@targets,\%urls,$crs,$cdom,$chome,$destdir,$timenow,\%importareas); |
my $copy_result = &Apache::imsprocessor::copy_resources('CSTR',$cms,\%hrefs,$tempdir,\@targets,\%urls,$crs,$cdom,$destdir,$timenow,\%importareas); |
|
|
&Apache::imsprocessor::build_structure($cms,'CSTR',$destdir,\%items,\%resinfo,\%resources,\@targets,\%hrefs,$udom,$uname,$newdir,$timenow,$cdom,$crs,\@timestamp,\%total,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\%boardnum,\@pages,\@sequences,\@topurls,\@topnames,\@packages,\%includeditems); |
&Apache::imsprocessor::build_structure($cms,'CSTR',$destdir,\%items,\%resinfo,\%resources,\@targets,\%hrefs,$udom,$uname,$newdir,$timenow,$cdom,$crs,\@timestamp,\%total,\@boards,\@announcements,\@quizzes,\@surveys,\@pools,\%boardnum,\@pages,\@sequences,\@topurls,\@topnames,\@packages,\%includeditems,\%randompicks); |
|
|
$r->print("<h3>IMS import completed</h3>"); |
$r->print("<h3>IMS import completed</h3>"); |
|
|
Line 708 sub display_three {
|
Line 708 sub display_three {
|
} elsif ($cms eq 'angel') { |
} elsif ($cms eq 'angel') { |
$r->print("<font face='arial,helvetica,sans-serif'>Your IMS package has been processed successfully. A total of $total{seq} sequences, $total{page} pages, and $total{board} bulletin boards have been created.<br /><br />\n"); |
$r->print("<font face='arial,helvetica,sans-serif'>Your IMS package has been processed successfully. A total of $total{seq} sequences, $total{page} pages, and $total{board} bulletin boards have been created.<br /><br />\n"); |
} |
} |
$r->print("Please view the imported items and use the LON-CAPA editing tools to make changes. The sequences directory contains a file named 'Top.sequence' whichincludes links to the items found at the top level of your IMS package. From there you can follow links to display all the imported items. Alternatively, you can browse the pages, sequences, problems and resfiles directories directly. Note if you rename a file, you will need to modify any .sequence files or .page files which include a reference to the renamed file.<br /><br />The final step in the IMS import process is to publish the materials you have imported into your Construction Space so that you can use them in a course. Once your file are published, subsequent re-publication will result in the storage of information about changes between the different versions.<br /><br /><a href='/priv/".$uname."/".$newdir."'>Display new directory</a></font>"); |
$r->print("Please view the imported items and use the LON-CAPA editing tools to make changes. The sequences directory contains a file named 'Top.sequence' which includes links to the items found at the top level of your IMS package. From there you can follow links to display all the imported items. Alternatively, you can browse the pages, sequences, problems and resfiles directories directly. Note if you rename a file, you will need to modify any .sequence files or .page files which include a reference to the renamed file.<br /><br />The final step in the IMS import process is to publish the materials you have imported into your Construction Space so that you can use them in a course. Once your file are published, subsequent re-publication will result in the storage of information about changes between the different versions.<br /><br /><a href='/priv/".$uname."/".$newdir."'>Display new directory</a></font>"); |
if ($destdir =~ m-^/home/$uname/public_html/-) { |
if ($destdir =~ m-^/home/$uname/public_html/-) { |
system (" rm -r -f $destdir/temp"); |
system (" rm -r -f $destdir/temp"); |
} |
} |
Line 803 sub handler {
|
Line 803 sub handler {
|
my $qcount = ''; |
my $qcount = ''; |
|
|
# get personal information for this user |
# get personal information for this user |
my $user=$ENV{'user.name'}; |
my $user=$env{'user.name'}; |
my $dom=$ENV{'user.domain'}; |
my $dom=$env{'user.domain'}; |
|
|
# |
# |
# re-attach user |
# re-attach user |
# |
# |
if ($ENV{'form.uploaduname'}) { |
if ($env{'form.uploaduname'}) { |
$ENV{'form.filename'}='/priv/'.$ENV{'form.uploaduname'}.'/'. |
$env{'form.filename'}='/priv/'.$env{'form.uploaduname'}.'/'. |
$ENV{'form.filename'}; |
$env{'form.filename'}; |
} |
} |
($uname,$udom)= |
($uname,$udom)= |
&Apache::loncacc::constructaccess($ENV{'form.filename'}, |
&Apache::loncacc::constructaccess($env{'form.filename'}, |
$r->dir_config('lonDefDomain')); |
$r->dir_config('lonDefDomain')); |
unless (($uname) && ($udom)) { |
unless (($uname) && ($udom)) { |
$r->log_reason($uname.' at '.$udom. |
$r->log_reason($uname.' at '.$udom. |
' trying to publish file '.$ENV{'form.filename'}. |
' trying to publish file '.$env{'form.filename'}. |
' - not authorized', |
' - not authorized', |
$r->filename); |
$r->filename); |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
|
my $fn; |
my $fn; |
if ($ENV{'form.filename'}) { |
if ($env{'form.filename'}) { |
$fn=$ENV{'form.filename'}; |
$fn=$env{'form.filename'}; |
$fn=~s/^http\:\/\/[^\/]+\///; |
$fn=~s/^http\:\/\/[^\/]+\///; |
$fn=~s/^\///; |
$fn=~s/^\///; |
$fn=~s/(\~|priv\/)(\w+)//; |
$fn=~s/(\~|priv\/)(\w+)//; |
$fn=~s/\/+/\//g; |
$fn=~s/\/+/\//g; |
} else { |
} else { |
$r->log_reason($ENV{'user.name'}.' at '.$ENV{'user.domain'}. |
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}. |
' unspecified filename for upload', $r->filename); |
' unspecified filename for upload', $r->filename); |
return HTTP_NOT_FOUND; |
return HTTP_NOT_FOUND; |
} |
} |
Line 854 sub handler {
|
Line 854 sub handler {
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
if ($ENV{'form.phase'} eq 'two') { |
if ($env{'form.phase'} eq 'two') { |
&jscript_one($fullpath,\$javascript,$uname,$udom); |
&jscript_one($fullpath,\$javascript,$uname,$udom); |
} elsif ($ENV{'form.phase'} eq 'three') { |
} elsif ($env{'form.phase'} eq 'three') { |
&jscript_two(\$javascript,$user,$dom,\$numcrs); |
&jscript_two(\$javascript,$user,$dom,\$numcrs); |
} elsif ($ENV{'form.phase'} eq 'four') { |
} elsif ($env{'form.phase'} eq 'four') { |
&jscript_three(\$javascript); |
&jscript_three(\$javascript); |
} |
} |
$r->print("<html><head><title>LON-CAPA Construction Space</title><script type=\"text/javascript\">\n//<!--\n$javascript\n// --></script>\n</head>"); |
$r->print("<html><head><title>LON-CAPA Construction Space</title><script type=\"text/javascript\">\n//<!--\n$javascript\n// --></script>\n</head>"); |
|
|
$r->print(&Apache::loncommon::bodytag('Upload IMS package to Construction Space',undef,$loadentries)); |
$r->print(&Apache::loncommon::bodytag('Upload IMS package to Construction Space',undef,$loadentries)); |
|
|
if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) { |
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
$r->print('<h3><font color=red>'.&mt('Co-Author').': '.$uname. |
$r->print('<h3><font color=red>'.&mt('Co-Author').': '.$uname. |
&mt(' at ').$udom.'</font></h3>'); |
&mt(' at ').$udom.'</font></h3>'); |
} |
} |
if ($ENV{'form.phase'} eq 'two') { |
if ($env{'form.phase'} eq 'two') { |
my $flag = &Apache::lonupload::phasetwo($r,$fn,$uname,$udom,'imsimport'); |
my $flag = &Apache::lonupload::phasetwo($r,$fn,$uname,$udom,'imsimport'); |
if ($flag eq 'ok') { |
if ($flag eq 'ok') { |
&display_one($r,$uname,$fn,$fullpath); |
&display_one($r,$uname,$fn,$fullpath); |
} |
} |
} elsif ( ($ENV{'form.phase'} eq 'three') || ($ENV{'form.phase'} eq 'four') ) { |
} elsif ( ($env{'form.phase'} eq 'three') || ($env{'form.phase'} eq 'four') ) { |
my $docroot = $ENV{'form.newdir'}; |
my $docroot = $env{'form.newdir'}; |
my $newdir = ''; |
my $newdir = ''; |
if ($docroot =~ m|public_html/(.+)$|) { |
if ($docroot =~ m|public_html/(.+)$|) { |
$newdir = $1; |
$newdir = $1; |
} |
} |
if ($ENV{'form.phase'} eq 'three') { |
if ($env{'form.phase'} eq 'three') { |
&display_two ($r,$zipupload,\@areas,\%areaname,\%cmsmap,$uname,$newdir,\$numcrs,$fullpath); |
&display_two ($r,$zipupload,\@areas,\%areaname,\%cmsmap,$uname,$newdir,\$numcrs,$fullpath); |
} elsif ($ENV{'form.phase'} eq 'four') { |
} elsif ($env{'form.phase'} eq 'four') { |
&display_three ($r,$uname,$udom,\@areas,\%areaname,\%cmsmap,$docroot,$newdir); |
&display_three ($r,$uname,$udom,\@areas,\%areaname,\%cmsmap,$docroot,$newdir); |
} |
} |
} else { |
} else { |