version 1.2, 2004/02/23 14:14:45
|
version 1.3, 2004/02/24 15:21:16
|
Line 502 sub expand_bb5 {
|
Line 502 sub expand_bb5 {
|
&process_group($key,$docroot,$destdir,\%{$resinfo{$key}}); |
&process_group($key,$docroot,$destdir,\%{$resinfo{$key}}); |
} elsif ($type{$key} eq "resource/x-bb-user") { |
} elsif ($type{$key} eq "resource/x-bb-user") { |
%{$resinfo{$key}} = (); |
%{$resinfo{$key}} = (); |
unless ($user_handling eq 'ignore') { |
unless ($users_handling eq 'ignore') { |
&process_user($key,$docroot,$destdir,\%{$resinfo{$key}},$user_crs,$user_cdom,$user_handling); |
&process_user($key,$docroot,$destdir,\%{$resinfo{$key}},$users_crs,$users_cdom,$users_handling); |
} |
} |
} |
} |
} |
} |
Line 628 sub expand_bb5 {
|
Line 628 sub expand_bb5 {
|
my $next_id = 1; |
my $next_id = 1; |
my $curr_id = 0; |
my $curr_id = 0; |
if ( (($type{$resnum{$key}} eq "resource/x-bb-document") || ($type{$resnum{$key}} eq "resource/x-bb-staffinfo") || ($type{$resnum{$key}} eq "resource/x-bb-externallink")) && ($resinfo{$resnum{$key}}{'isfolder'} eq "true") ) { |
if ( (($type{$resnum{$key}} eq "resource/x-bb-document") || ($type{$resnum{$key}} eq "resource/x-bb-staffinfo") || ($type{$resnum{$key}} eq "resource/x-bb-externallink")) && ($resinfo{$resnum{$key}}{'isfolder'} eq "true") ) { |
# if ( ($type{$resnum{$key}} eq "resource/x-bb-staffinfo") && ($resinfo{$resnum{$key}}{'isfolder'} eq "true") ) { |
|
# print "$key $filepath{$key} $resnum{$key} $title{$key}\n"; |
|
# print "Folder for item - $key - res - $resnum{$key}\n"; |
|
# print "$key, $contentscount{$key}\n"; |
|
# foreach (@{$contents{$key}}) { |
|
# print "$key, $_\n"; |
|
# } |
|
# print STDERR "Contents Count for $key is $contentscount{$key}\n"; |
|
open(LOCFILE,">$destdir/sequences/$key.sequence"); |
open(LOCFILE,">$destdir/sequences/$key.sequence"); |
print LOCFILE "<map>\n"; |
print LOCFILE "<map>\n"; |
$totseq ++; |
$totseq ++; |
Line 880 sub process_user {
|
Line 872 sub process_user {
|
$p->eof; |
$p->eof; |
|
|
my $configvars = &LONCAPA::Configuration::read_conf('loncapa.conf'); |
my $configvars = &LONCAPA::Configuration::read_conf('loncapa.conf'); |
my $xmlstem = $$configvars{'lonDaemons'}."/tmp/".$dom."_".$crs."_"; |
my $xmlstem = $$configvars{'lonDaemons'}."/tmp/".$user_cdom."_".$user_crs."_"; |
|
|
open (STUFILE,"> |
|
foreach my $user_id (keys %{$settings}) { |
foreach my $user_id (keys %{$settings}) { |
if ($$settings{$user_id}{user_role} eq "s") { |
if ($$settings{$user_id}{user_role} eq "s") { |
# enroll as a single student |
|
} elsif ($user_handling eq 'enrollall') { |
} elsif ($user_handling eq 'enrollall') { |
# enroll as another user type |
|
} |
} |
} |
} |
} |
} |
Line 1315 sub process_db {
|
Line 1306 sub process_db {
|
$p->parse_file($xmlfile); |
$p->parse_file($xmlfile); |
$p->eof; |
$p->eof; |
|
|
# if ($destcourse =~ m/^(\d)(\d)(\d)/) { |
|
# $longcourse = $1.'/'.$2.'/'.$3.'/'.$destcourse; |
|
# } |
|
# my $bbfilename = '/home/httpd/lonUsers/'.$udom.'/'.$longcourse.'bulletinpage_'.$timestamp.'.db'; |
|
# my %hash; |
|
# tie(%hash,'GDBM_File',$bbfilename,&GDBM_WRCREAT,0640); |
|
# $hash{'aaa_title'}=$$settings{title}; |
|
# untie %hash; |
|
if (defined($$settings{text})) { |
if (defined($$settings{text})) { |
if ($$settings{ishtml} eq "false") { |
if ($$settings{ishtml} eq "false") { |
if ($$settings{isnewline} eq "true") { |
if ($$settings{isnewline} eq "true") { |
Line 2112 $linktag|;
|
Line 2095 $linktag|;
|
} |
} |
|
|
sub expand_angel { |
sub expand_angel { |
my ($r,$uname,$udom,$fn,$page) = @_; |
my ($r,$uname,$udom,$fn,$page,$bb_crs,$bb_cdom,$bb_handling) = @_; |
my @state = (); |
my @state = (); |
my @seq = "Top"; |
my @seq = "Top"; |
my $lastitem; |
my $lastitem; |
my $itm = ''; |
my $itm = ''; |
my %resnum = (); |
my %resnum = (); |
|
my %revitm = (); |
my %title = (); |
my %title = (); |
my %filepath = (); |
my %filepath = (); |
my %contentscount = ("Top" => 0); |
my %contentscount = ("Top" => 0); |
Line 2170 sub expand_angel {
|
Line 2154 sub expand_angel {
|
} |
} |
if (("@state" eq $searchstr) && (@state > 3)) { |
if (("@state" eq $searchstr) && (@state > 3)) { |
$itm = $attr->{identifier}; |
$itm = $attr->{identifier}; |
$resnum{$itm} = $attr->{identifierref}; |
if ($attr->{identifierref} =~ m/^res(.+)$/) { |
|
$resnum{$itm} = $1; |
|
} |
|
$revitm{$resnum{$itm}} = $itm; |
if ($start > @seq) { |
if ($start > @seq) { |
unless ($lastitem eq '') { |
unless ($lastitem eq '') { |
push @seq, $lastitem; |
push @seq, $lastitem; |
Line 2205 sub expand_angel {
|
Line 2192 sub expand_angel {
|
} |
} |
} elsif ("@state" eq "manifest resources resource" ) { |
} elsif ("@state" eq "manifest resources resource" ) { |
$identifier = $attr->{identifier}; |
$identifier = $attr->{identifier}; |
$file{$identifier} = $attr->{href}; |
$identifier = substr($identifier,3); |
|
if ($attr->{href} =~ m-^_assoc/$identifier/(.+)$-) { |
|
$file{$identifier} = $1; |
|
} |
@{$href{$identifier}} = (); |
@{$href{$identifier}} = (); |
} elsif ("@state" eq "manifest resources resource file") { |
} elsif ("@state" eq "manifest resources resource file") { |
push @{$href{$identifier}},$attr->{href}; |
if ($attr->{href} =~ m/^_assoc\\$identifier\\(.+)$/) { |
if ($attr->{href} =~ m/^Icons\\icon(\w+)\.gif/) { |
push @{$href{$identifier}},$1; |
|
} elsif ($attr->{href} =~ m/^Icons\\icon(\w+)\.gif/) { |
$type{$identifier} = $1; |
$type{$identifier} = $1; |
} |
} |
} |
} |
}, "tagname, attr"], |
}, "tagname, attr"], |
text_h => |
text_h => |
Line 2249 sub expand_angel {
|
Line 2240 sub expand_angel {
|
} |
} |
foreach my $key (sort keys %href) { |
foreach my $key (sort keys %href) { |
foreach my $file (@{$href{$key}}) { |
foreach my $file (@{$href{$key}}) { |
if ($file =~ m/^_assoc/) { |
print STDERR "File is $file, for $key\n"; |
my $filepath = $file; |
$file =~ s-\\-/-g; |
if (!-e "$destdir/resfiles/$key") { |
my $filepath = $file; |
mkdir("$destdir/resfiles/$key",0755); |
if (!-e "$destdir/resfiles/$key") { |
} |
mkdir("$destdir/resfiles/$key",0755); |
while ($filepath =~ m-(\w+)\\(.+)-) { |
} |
$filepath = $2; |
while ($filepath =~ m-(\w+)/(.+)-) { |
if (!-e "$destdir/resfiles/$key/$1") { |
$filepath = $2; |
mkdir("$destdir/resfiles/$key/$1",0755); |
if (!-e "$destdir/resfiles/$key/$1") { |
} |
mkdir("$destdir/resfiles/$key/$1",0755); |
} |
} |
system("cp $docroot/temp/$key/$file $destdir/resfiles/$key/$file"); |
|
} |
} |
|
system("cp $docroot/temp/_assoc/$key/$file $destdir/resfiles/$key/$file"); |
} |
} |
} |
} |
|
|
# ANGEL types FILE FOLDER PAGE MESSAGE FORM QUIZ BOARD |
|
|
|
|
# ANGEL types FILE FOLDER PAGE LINK MESSAGE FORM QUIZ BOARD |
|
my $currboard = ''; |
|
my @boards = (); |
|
my %messages = (); |
|
my @timestamp = (); |
|
my %boardnum = (); |
|
my $board_id = time; |
|
my $board_count = 0; |
foreach my $key (sort keys %type) { |
foreach my $key (sort keys %type) { |
if ($type{$key} eq "BOARD") { |
if ($type{$key} eq "BOARD") { |
|
push @boards, $key; |
|
$boardnum{$revitm{$key}} = $board_count ; |
|
$currboard = $key; |
|
@{$messages{$key}} = (); |
|
$timestamp[$board_count] = $board_id; |
|
$board_id ++; |
|
$board_count ++; |
|
} elsif ($type{$key} eq "MESSAGE") { |
|
push @{$messages{$currboard}}, $key; |
|
} elsif ($type{$key} eq "FILE" || $type{$key} eq "FOLDER" || $type{$key} eq "PAGE" || $type{$key} eq "LINK") { |
%{$resinfo{$key}} = (); |
%{$resinfo{$key}} = (); |
&angel_db($key,$docroot,$destdir,\%{$resinfo{$key}},$udom,$uname); |
|
} elsif ($type{$key} eq "FILE" || $type{$key} eq "FOLDER" || $type{$key} eq "PAGE") { |
|
%{$resinfo{$key}} = (); |
|
&angel_content($key,$docroot,$dirname,$destdir,\%{$resinfo{$key}}); |
|
} elsif ($type{$key} eq "QUIZ") { |
} elsif ($type{$key} eq "QUIZ") { |
%{$resinfo{$key}} = (); |
%{$resinfo{$key}} = (); |
&angel_assessment($key,$docroot,$dirname,$destdir,\%{$resinfo{$key}}); |
# &angel_assessment($key,$docroot,$dirname,$destdir,\%{$resinfo{$key}}); |
} elsif ($type{$key} eq "FORM") { |
} elsif ($type{$key} eq "FORM") { |
%{$resinfo{$key}} = (); |
%{$resinfo{$key}} = (); |
&angel_assessment($key,$docroot,$dirname,$destdir,\%{$resinfo{$key}}); |
# &angel_assessment($key,$docroot,$dirname,$destdir,\%{$resinfo{$key}}); |
} |
} |
} |
} |
|
|
my $nextnum = 0; |
my $longcrs = ''; |
open(TOPFILE,">$destdir/sequences/ims_import.sequence"); |
if ($bb_crs =~ m/^(\d)(\d)(\d)/) { |
print TOPFILE "<map>\n"; |
$longcrs = $1.'/'.$2.'/'.$3.'/'.$bb_crs; |
my $fileopen = 0; |
} |
my $areakey; |
for (my $i=0; $i<@boards; $i++) { |
my $areacount = 0; |
my %msgidx = (); |
my $lastentry = ''; |
my $forumtext = ''; |
my $notlastentry = ''; |
my $boardname = 'bulletinpage_'.$timestamp[$i]; |
|
my $forumfile = "$destdir/resfiles/$boards[$i]/$file{$boards[$i]}"; |
|
my @state = (); |
|
my $p = HTML::Parser->new |
|
( |
|
xml_mode => 1, |
|
start_h => |
|
[sub { |
|
my ($tagname, $attr) = @_; |
|
push @state, $tagname; |
|
}, "tagname, attr"], |
|
text_h => |
|
[sub { |
|
my ($text) = @_; |
|
if ("@state" eq "html body div div") { |
|
$forumtext = $text; |
|
} |
|
}, "dtext"], |
|
end_h => |
|
[sub { |
|
my ($tagname) = @_; |
|
pop @state; |
|
}, "tagname"], |
|
); |
|
$p->parse_file($xmlfile); |
|
$p->eof; |
|
|
|
my %boardinfo = ( |
|
'aaa_title' => $title{$revitm{$boards[$i]}}, |
|
'bbb_content' => $forumtext, |
|
'ccc_webreferences' => '', |
|
'uploaded.lastmodified' => time, |
|
); |
|
my $msgcount = 0; |
|
|
|
my $putresult = &Apache::lonnet::put($boardname,\%boardinfo,$bb_cdom,$bb_crs); |
|
if ($bb_handling eq 'importall') { |
|
foreach my $msg_id (@{$messages{$boards[$i]}}) { |
|
$msgcount ++; |
|
$msgidx{$msg_id} = $msgcount; |
|
my %contrib = ( |
|
'sendername' => 'Username not recorded', |
|
'senderdomain' => $bb_cdom, |
|
'screenname' => '', |
|
'message' => $title{$revitm{$msg_id}} |
|
); |
|
unless ( $parentseq{$revitm{$msg_id}} eq $revitm{$boards[$i]} ) { |
|
$contrib{replyto} = $msgidx{$resnum{$parentseq{$revitm{$msg_id}}}}; |
|
} |
|
if ( @{$href{$msg_id}} > 1 ) { |
|
my $newurl = ''; |
|
foreach my $file (@{$href{$msg_id}}) { |
|
unless ($file eq 'pg'.$msg_id.'.htm') { |
|
$newurl = $msg_id.$file; |
|
unless ($longcrs eq '') { |
|
if (!-e "/home/httpd/lonUsers/$bb_cdom/$longcrs/userfiles") { |
|
mkdir("/home/httpd/lonUsers/$bb_cdom/$longcrs/userfiles",0755); |
|
} |
|
if (!-e "/home/httpd/lonUsers/$bb_cdom/$longcrs/userfiles/$newurl") { |
|
system("cp $destdir/resfiles/$file /home/httpd/lonUsers/$bb_cdom/$longcrs/userfiles/$newurl"); |
|
} |
|
$contrib{attachmenturl} = '/uploaded/'.$bb_cdom.'/'.$bb_crs.'/'.$newurl; |
|
} |
|
} |
|
} |
|
} |
|
my $xmlfile = "$destdir/resfiles/$msg_id/$file{$msg_id}"; |
|
&angel_message($msg_id,\%contrib,$xmlfile); |
|
unless ($file{$msg_id} eq '') { |
|
unlink($xmlfile); |
|
} |
|
my $symb = 'bulletin___'.$timestamp[$i].'___adm/wrapper/adm/'.$bb_cdom.'/'.$uname.'/'.$timestamp[$i].'/bulletinboard'; |
|
my $postresult = &addposting($symb,\%contrib,$bb_cdom,$bb_crs); |
|
} |
|
} |
|
} |
|
|
|
my @resources = sort keys %resnum; |
|
unshift @resources, "Top"; |
|
$resnum{'Top'} = 'toplevel'; |
|
$type{'toplevel'} = "FOLDER"; |
|
|
my %pagecount = (); |
my %pagecount = (); |
my %pagecontents = (); |
my %pagecontents = (); |
my %pageflag = (); |
my %pageflag = (); |
my %seqflag = (); |
my %seqflag = (); |
my %seqcount = (); |
my %seqcount = (); |
|
my %boardflag = (); |
|
my %boardcount = (); |
|
|
foreach my $key (sort keys %resnum) { |
foreach my $key (@resources) { |
|
print STDERR "Key is $key, resnum is $resnum{$key}, type is $type{$resnum{$key}}\n"; |
$pageflag{$key} = 0; |
$pageflag{$key} = 0; |
$seqflag{$key} = 0; |
$seqflag{$key} = 0; |
$seqcount{$key} = 0; |
$seqcount{$key} = 0; |
$pagecount{$key} = -1; |
$pagecount{$key} = -1; |
if ($filepath{$key} eq 'Top') { |
$boardflag{$key} = 0; |
$topnum ++; |
$boardcount{$key} = 0; |
$nextnum = $topnum +1; |
my $src =""; |
print TOPFILE qq|<resource id="$topnum" src="/res/$udom/$uname/$newdir/sequences/$key.sequence" title="$title{$key}"|; |
my $next_id = 1; |
if ($topnum == 1) { |
my $curr_id = 0; |
print TOPFILE qq| type="start"></resource> |
if ($type{$resnum{$key}} eq "FOLDER") { |
<link from="$topnum" to="$nextnum" index="$topnum"></link>\n|; |
open(LOCFILE,">$destdir/sequences/$key.sequence"); |
if ($topnum == $contentscount{'Top'}) { |
print LOCFILE "<map>\n"; |
print TOPFILE qq|<resource id="$nextnum" src="" type="finish"></resource>\n|; |
if ($contentscount{$key} == 0) { |
} |
print LOCFILE qq|<resource id="1" src="" type="start"></resource> |
} else { |
|
if ($topnum == $contentscount{'Top'}) { |
|
print TOPFILE qq| type="finish"></resource>\n|; |
|
} else { |
|
print TOPFILE qq|></resource> |
|
<link from="$topnum" to="$nextnum" index="$topnum"></link>\n|; |
|
} |
|
} |
|
|
|
my $src =""; |
|
my $next_id = 1; |
|
my $curr_id = 0; |
|
if ($type{$resnum{$key}} eq "FOLDER") { |
|
open(LOCFILE,">$destdir/sequences/$key.sequence"); |
|
print LOCFILE "<map>\n"; |
|
if ($contentscount{$key} == 0) { |
|
print LOCFILE qq|<resource id="1" src="" type="start"></resource> |
|
<link from="1" to="2" index="1"></link> |
<link from="1" to="2" index="1"></link> |
<resource id="2" src="" type="finish"></resource>\n|; |
<resource id="2" src="" type="finish"></resource>\n|; |
} else { |
} else { |
if ($type{$resnum{$contents{$key}[0]}} eq "FOLDER") { |
if ($type{$resnum{$contents{$key}[0]}} eq "FOLDER") { |
$src = 'sequences/'.$contents{$key}[0].".sequence"; |
$src = 'sequences/'.$contents{$key}[0].".sequence"; |
$pageflag{$key} = 0; |
$pageflag{$key} = 0; |
$seqflag{$key} = 1; |
$seqflag{$key} = 1; |
$seqcount{$key} ++; |
$seqcount{$key} ++; |
|
} elsif ($type{$resnum{$contents{$key}[0]}} eq "BOARD") { |
|
$src = "/adm/$bb_cdom/$uname/$timestamp[$boardnum{$key}]/bulletinboard"; |
|
$pageflag{$key} = 0; |
|
$boardflag{$key} = 1; |
|
$boardcount{$key} ++; |
|
} elsif ($type{$resnum{$contents{$key}[0]}} ne "MESSAGE") { |
|
if ($pageflag{$key}) { |
|
push @{$pagecontents{$key}[$pagecount{$key}]},$contents{$key}[0]; |
} else { |
} else { |
if ($pageflag{$key}) { |
$pagecount{$key} ++; |
push @{$pagecontents{$key}[$pagecount{$key}]},$contents{$key}[0]; } else { |
$src = 'pages/'.$key.'_'.$pagecount{$key}.'.page'; |
$pagecount{$key} ++; |
@{$pagecontents{$key}[$pagecount{$key}]} = ("$contents{$key}[0]"); |
$src = 'pages/'.$key.'_'.$pagecount{$key}.'.page'; |
$seqflag{$key} = 0; |
@{$pagecontents{$key}[$pagecount{$key}]} = ("$contents{$key}[0]"); |
|
$seqflag{$key} = 0; |
|
} |
|
} |
} |
unless ($pageflag{$key}) { |
} |
print LOCFILE qq|<resource id="1" src="/res/$udom/$uname/$newdir/$src" title="$title{$contents{$key}[0]}" type="start"|; |
unless ($pageflag{$key}) { |
unless ($seqflag{$key}) { |
print LOCFILE qq|<resource id="1" src="/res/$udom/$uname/$newdir/$src" title="$title{$contents{$key}[0]}" type="start"|; |
$pageflag{$key} = 1; |
unless ($seqflag{$key} || $boardflag{$key}) { |
} |
$pageflag{$key} = 1; |
} |
} |
if ($contentscount{$key} == 1) { |
} |
print LOCFILE qq|></resource> |
if ($contentscount{$key} == 1) { |
|
print LOCFILE qq|></resource> |
<link from="1" to="2" index="1"></link> |
<link from="1" to="2" index="1"></link> |
<resource id="2" src="" type="finish"></resource>\n|; |
<resource id="2" src="" type="finish"></resource>\n|; |
} else { |
} else { |
if ($contentscount{$key} > 2 ) { |
if ($contentscount{$key} > 2 ) { |
for (my $i=1; $i<$contentscount{$key}-1; $i++) { |
for (my $i=1; $i<$contentscount{$key}-1; $i++) { |
if ($resinfo{$resnum{$contents{$key}[$i]}}{'isfolder'} eq "true") { |
if ($type{$resnum{$contents{$key}[$i]}} eq "FOLDER") { |
$src = 'sequences/'.$contents{$key}[$i].".sequence"; |
$src = 'sequences/'.$contents{$key}[$i].".sequence"; |
$pageflag{$key} = 0; |
$pageflag{$key} = 0; |
$seqflag{$key} = 1; |
$seqflag{$key} = 1; |
$seqcount{$key} ++; |
$seqcount{$key} ++; |
|
} elsif ($type{$resnum{$contents{$key}[0]}} eq "BOARD") { |
|
$src = "/adm/$bb_cdom/$uname/$timestamp[$boardnum{$key}]/bulletinboard"; |
|
$pageflag{$key} = 0; |
|
$boardflag{$key} = 1; |
|
$boardcount{$key} ++; |
|
} elsif ($type{$resnum{$contents{$key}[0]}} ne "MESSAGE") { |
|
if ($pageflag{$key}) { |
|
push @{$pagecontents{$key}[$pagecount{$key}]},$contents{$key}[$i]; |
} else { |
} else { |
if ($pageflag{$key}) { |
$pagecount{$key} ++; |
push @{$pagecontents{$key}[$pagecount{$key}]},$contents{$key}[$i]; |
$src = 'pages/'.$key.'_'.$pagecount{$key}.'.page'; |
} else { |
@{$pagecontents{$key}[$pagecount{$key}]} = ("$contents{$key}[$i]"); |
$pagecount{$key} ++; |
$seqflag{$key} = 0; |
$src = 'pages/'.$key.'_'.$pagecount{$key}.'.page'; |
|
@{$pagecontents{$key}[$pagecount{$key}]} = ("$contents{$key}[$i]"); |
|
$seqflag{$key} = 0; |
|
} |
|
} |
} |
unless ($pageflag{$key}) { |
} |
$curr_id ++; |
unless ($pageflag{$key}) { |
$next_id ++; |
$curr_id ++; |
print LOCFILE qq|></resource> |
$next_id ++; |
|
print LOCFILE qq|></resource> |
<link from="$curr_id" to="$next_id" index="$curr_id"></link> |
<link from="$curr_id" to="$next_id" index="$curr_id"></link> |
<resource id="$next_id" src="/res/$udom/$uname/$newdir/$src" title="$title{$contents{$key}[$i]}"|; |
<resource id="$next_id" src="/res/$udom/$uname/$newdir/$src" title="$title{$contents{$key}[$i]}"|; |
unless ($seqflag{$key}) { |
unless ($seqflag{$key} || $boardflag{$key}) { |
$pageflag{$key} = 1; |
$pageflag{$key} = 1; |
} |
|
} |
} |
} |
} |
} |
} |
if ($resinfo{$resnum{$contents{$key}[$contentscount{$key}-1]}}{'isfolder'} eq "true") { |
} |
$src = 'sequences/'.$contents{$key}[$contentscount{$key}-1].".sequence"; |
if ($type{$resnum{$contents{$key}[$contentscount{$key}-1]}} eq "FOLDER") { |
$pageflag{$key} = 0; |
$src = 'sequences/'.$contents{$key}[$contentscount{$key}-1].".sequence"; |
$seqflag{$key} = 1; |
$pageflag{$key} = 0; |
|
$seqflag{$key} = 1; |
|
} elsif ($type{$resnum{$contents{$key}[0]}} eq "BOARD") { |
|
$src = "/adm/$bb_cdom/$uname/$timestamp[$boardnum{$key}]/bulletinboard"; |
|
$pageflag{$key} = 0; |
|
$boardflag{$key} = 1; |
|
} elsif ($type{$resnum{$contents{$key}[0]}} ne "MESSAGE") { |
|
if ($pageflag{$key}) { |
|
push @{$pagecontents{$key}[$pagecount{$key}]},$contents{$key}[$contentscount{$key}-1]; |
} else { |
} else { |
if ($pageflag{$key}) { |
$pagecount{$key} ++; |
push @{$pagecontents{$key}[$pagecount{$key}]},$contents{$key}[$contentscount{$key}-1]; |
$src = 'pages/'.$key.'_'.$pagecount{$key}.'.page'; |
} else { |
@{$pagecontents{$key}[$pagecount{$key}]} = ("$contents{$key}[$contentscount{$key}-1]"); |
$pagecount{$key} ++; |
|
$src = 'pages/'.$key.'_'.$pagecount{$key}.'.page'; |
|
@{$pagecontents{$key}[$pagecount{$key}]} = ("$contents{$key}[$contentscount{$key}-1]"); |
|
} |
|
} |
} |
if ($pageflag{$key}) { |
} |
if ($seqcount{$key} + $pagecount{$key} +1 == 1) { |
if ($pageflag{$key}) { |
print LOCFILE qq|></resource> |
if ($seqcount{$key} + $pagecount{$key} + $boardcount{$key} +1 == 1) { |
|
print LOCFILE qq|></resource> |
<link from="1" index="1" to="2"> |
<link from="1" index="1" to="2"> |
<resource id ="2" src="" title="" type="finish"></resource>\n|; |
<resource id ="2" src="" title="" type="finish"></resource>\n|; |
} else { |
|
print LOCFILE qq| type="finish"></resource>\n|; |
|
} |
|
} else { |
} else { |
$curr_id ++; |
print LOCFILE qq| type="finish"></resource>\n|; |
$next_id ++; |
} |
print LOCFILE qq|></resource> |
} else { |
|
$curr_id ++; |
|
$next_id ++; |
|
print LOCFILE qq|></resource> |
<link from="$curr_id" to="$next_id" index="$curr_id"></link> |
<link from="$curr_id" to="$next_id" index="$curr_id"></link> |
<resource id="$next_id" src="/res/$udom/$uname/$newdir/$src" title="$title{$contents{$key}[$contentscount{$key}-1]}" type="finish"></resource>\n|; |
<resource id="$next_id" src="/res/$udom/$uname/$newdir/$src" title="$title{$contents{$key}[$contentscount{$key}-1]}" type="finish"></resource>\n|; |
} |
|
} |
} |
} |
} |
print LOCFILE "</map>\n"; |
|
close(LOCFILE); |
|
} |
} |
|
print LOCFILE "</map>\n"; |
|
close(LOCFILE); |
|
} |
} |
} |
|
|
foreach my $key (sort keys %pagecontents) { |
foreach my $key (sort keys %pagecontents) { |
Line 2448 sub expand_angel {
|
Line 2534 sub expand_angel {
|
close(PAGEFILE); |
close(PAGEFILE); |
} |
} |
} |
} |
system(" rm -r $docroot/temp"); |
# system(" rm -r $docroot/temp"); |
|
} |
|
|
|
sub angel_message { |
|
my ($msg_id,$contrib,$xmlfile) = @_; |
|
my @state = (); |
|
my $p = HTML::Parser->new |
|
( |
|
xml_mode => 1, |
|
start_h => |
|
[sub { |
|
my ($tagname, $attr) = @_; |
|
push @state, $tagname; |
|
}, "tagname, attr"], |
|
text_h => |
|
[sub { |
|
my ($text) = @_; |
|
if ("@state" eq "html body table tr td div small span") { |
|
$$contrib{'plainname'} = $text; |
|
} elsif ("@state" eq "html body div div") { |
|
$$contrib{'message'} .= '<br /><br />'.$text; |
|
} |
|
}, "dtext"], |
|
end_h => |
|
[sub { |
|
my ($tagname) = @_; |
|
pop @state; |
|
}, "tagname"], |
|
); |
|
$p->parse_file($xmlfile); |
|
$p->eof; |
} |
} |
|
|
sub get_ccroles { |
sub get_ccroles { |
Line 2576 sub handler {
|
Line 2692 sub handler {
|
|
|
if ($ENV{'form.phase'} eq 'three') { |
if ($ENV{'form.phase'} eq 'three') { |
$current_page = &display_control(); |
$current_page = &display_control(); |
my @PAGES = ('ChooseDir','Blackboard5','ANGEL','WebCT'); |
my @PAGES = ('ChooseDir','Confirmation'); |
$page_name = $PAGES[$current_page]; |
$page_name = $PAGES[$current_page]; |
|
|
if ($page_name eq 'ChooseDir') { |
if ($page_name eq 'ChooseDir') { |
&jscript_zero($fullpath,\$javascript,$uname,$udom); |
&jscript_zero($fullpath,\$javascript,$uname,$udom); |
} elsif ($page_name eq 'Confirmation') { |
} elsif ($page_name eq 'Confirmation') { |
&jscript_two(\$javascript,$uname); |
# &jscript_two(\$javascript,$uname); |
} |
} |
} elsif ($ENV{'form.phase'} eq 'two') { |
} elsif ($ENV{'form.phase'} eq 'two') { |
&jscript_zero($fullpath,\$javascript,$uname,$udom); |
&jscript_zero($fullpath,\$javascript,$uname,$udom); |
Line 2600 sub handler {
|
Line 2716 sub handler {
|
my $bb_crs = ''; |
my $bb_crs = ''; |
my $bb_cdom = ''; |
my $bb_cdom = ''; |
my $bb_handling = ''; |
my $bb_handling = ''; |
|
my $source = $ENV{'form.source'}; |
if ( defined($ENV{'form.bb_crs'}) ) { |
if ( defined($ENV{'form.bb_crs'}) ) { |
($bb_cdom,$bb_crs) = split/\//,$ENV{'form.bb_crs'}; |
($bb_cdom,$bb_crs) = split/\//,$ENV{'form.bb_crs'}; |
} |
} |
Line 2616 sub handler {
|
Line 2733 sub handler {
|
$users_handling = $ENV{'form.user_handling'}; |
$users_handling = $ENV{'form.user_handling'}; |
} |
} |
my ($totseq,$totpage,$totprob); |
my ($totseq,$totpage,$totprob); |
&display_zero ($r,$uname,$fn,$current_page,$fullpath) if $page_name eq 'ChooseDir'; |
print STDERR "Page name is $page_name\n"; |
($totseq,$totpage,$totprob) = &expand_bb5 ($r,$uname,$udom,$fn,$current_page,$bb_crs,$bb_cdom,$bb_handling,$users_crs,$users_cdom,$users_handling) if $page_name eq 'Blackboard5'; |
if ($page_name eq 'ChooseDir') { |
($totseq,$totpage,$totprob) = &expand_angel ($r,$uname,$udom,$fn,$current_page) if $page_name eq 'ANGEL'; |
&display_zero ($r,$uname,$fn,$current_page,$fullpath); |
&expand_webct ($r,$uname,$udom,$fn,$current_page) if $page_name eq 'WebCT'; |
} elsif ($page_name eq 'Confirmation') { |
|
($totseq,$totpage,$totprob) = &expand_bb5 ($r,$uname,$udom,$fn,$current_page,$bb_crs,$bb_cdom,$bb_handling,$users_crs,$users_cdom,$users_handling) if $source eq 'bb5'; |
|
($totseq,$totpage,$totprob) = &expand_angel ($r,$uname,$udom,$fn,$current_page,$bb_crs,$bb_cdom,$bb_handling) if $source eq 'angel'; |
|
&expand_webct ($r,$uname,$udom,$fn,$current_page) if $source eq 'webct'; |
|
} |
$r->print("<h3>Step 3: Publish your new LON-CAPA materials</h3>"); |
$r->print("<h3>Step 3: Publish your new LON-CAPA materials</h3>"); |
$r->print("<font face='arial,helvetica,sans-serif'>Your IMS package has been processed successfully. A total of $totseq sequences, $totpage pages, and $totprob problems have been created.<br /><br />\n"); |
$r->print("<font face='arial,helvetica,sans-serif'>Your IMS package has been processed successfully. A total of $totseq sequences, $totpage pages, and $totprob problems have been created.<br /><br />\n"); |
|
|